38 #include "../include/geometry_structure.hpp"
39 #include "../include/adt_structure.hpp"
41 #include <sys/types.h>
45 #define EPSILON 0.000001
49 #define CROSS(dest,v1,v2) \
50 (dest)[0] = (v1)[1]*(v2)[2] - (v1)[2]*(v2)[1]; \
51 (dest)[1] = (v1)[2]*(v2)[0] - (v1)[0]*(v2)[2]; \
52 (dest)[2] = (v1)[0]*(v2)[1] - (v1)[1]*(v2)[0];
56 #define DOT(v1,v2) ((v1)[0]*(v2)[0] + (v1)[1]*(v2)[1] + (v1)[2]*(v2)[2]);
60 #define SUB(dest,v1,v2) \
61 (dest)[0] = (v1)[0] - (v2)[0]; \
62 (dest)[1] = (v1)[1] - (v2)[1]; \
63 (dest)[2] = (v1)[2] - (v2)[2];
114 unsigned long iElem, iElem_Bound, iEdge, iFace, iPoint, iVertex;
115 unsigned short iMarker;
118 for (iElem = 0; iElem <
nElem; iElem++)
119 if (
elem[iElem] != NULL)
delete elem[iElem];
124 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
125 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
126 if (
bound[iMarker][iElem_Bound] != NULL)
delete bound[iMarker][iElem_Bound];
128 if (
bound[iMarker] != NULL)
delete []
bound[iMarker];
134 for (iFace = 0; iFace <
nFace; iFace ++)
135 if (
face[iFace] != NULL)
delete face[iFace];
140 for (iPoint = 0; iPoint <
nPointNode; iPoint ++)
141 if (
node[iPoint] != NULL)
delete node[iPoint];
147 for (iEdge = 0; iEdge <
nEdge; iEdge ++)
148 if (
edge[iEdge] != NULL)
delete edge[iEdge];
153 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
154 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
155 if (
vertex[iMarker][iVertex] != NULL)
delete vertex[iMarker][iVertex];
163 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
164 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
165 if (
newBound[iMarker][iElem_Bound] != NULL)
delete []
newBound[iMarker][iElem_Bound];
184 for(iMarker=0; iMarker <
nMarker; iMarker++){
191 for(iMarker=0; iMarker <
nMarker; iMarker++){
200 su2double CrossProduct[3], iVector[3], jVector[3], distance, modulus;
203 for (iDim = 0; iDim < 3; iDim ++) {
204 iVector[iDim] = jCoord[iDim] - iCoord[iDim];
205 jVector[iDim] = kCoord[iDim] - iCoord[iDim];
208 CrossProduct[0] = iVector[1]*jVector[2] - iVector[2]*jVector[1];
209 CrossProduct[1] = iVector[2]*jVector[0] - iVector[0]*jVector[2];
210 CrossProduct[2] = iVector[0]*jVector[1] - iVector[1]*jVector[0];
212 modulus = sqrt(CrossProduct[0]*CrossProduct[0]+CrossProduct[1]*CrossProduct[1]+CrossProduct[2]*CrossProduct[2]);
215 for (iDim = 0; iDim < 3; iDim ++)
216 distance += CrossProduct[iDim]*(Coord[iDim]-iCoord[iDim]);
224 unsigned long iPoint = 0;
225 unsigned short iNode;
226 for (iNode = 0; iNode <
node[first_point]->
GetnPoint(); iNode++) {
228 if (iPoint == second_point)
break;
231 if (iPoint == second_point)
return node[first_point]->
GetEdge(iNode);
234 SPRINTF(buf,
"Can't find the edge that connects %lu and %lu.", first_point, second_point);
241 unsigned long iPoint = 0;
242 unsigned short iNode;
243 for (iNode = 0; iNode <
node[first_point]->
GetnPoint(); iNode++) {
245 if (iPoint == second_point)
break;
248 if (iPoint == second_point)
return true;
254 unsigned long iPoint, jPoint;
256 unsigned short jNode, iNode;
260 for (iPoint = 0; iPoint <
nPoint; iPoint++)
261 for (iNode = 0; iNode <
node[iPoint]->
GetnPoint(); iNode++) {
264 if (
node[jPoint]->GetPoint(jNode) == iPoint) {
268 if (TestEdge == -1) {
277 for (iPoint = 0; iPoint <
nPoint; iPoint++)
278 for (iNode = 0; iNode <
node[iPoint]->
GetnPoint(); iNode++) {
281 if (iPoint < jPoint)
edge[iEdge] =
new CEdge(iPoint, jPoint,
nDim);
320 para_file.open(
"test_geometry.dat", ios::out);
324 for (
unsigned long iEdge = 0; iEdge <
nEdge; iEdge++) {
325 para_file <<
"Edge index: " << iEdge << endl;
328 para_file <<
" Face normal : ";
329 for (
unsigned short iDim = 0; iDim <
nDim; iDim++)
330 para_file << Normal[iDim] <<
"\t";
339 for (
unsigned short iMarker =0; iMarker <
nMarker; iMarker++) {
340 para_file <<
"Marker index: " << iMarker << endl;
341 for (
unsigned long iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
342 para_file <<
" Vertex index: " << iVertex << endl;
343 para_file <<
" Point index: " <<
vertex[iMarker][iVertex]->
GetNode() << endl;
344 para_file <<
" Point coordinates : ";
345 for (
unsigned short iDim = 0; iDim <
nDim; iDim++) {
349 para_file <<
" Face normal : ";
350 for (
unsigned short iDim = 0; iDim <
nDim; iDim++)
351 para_file << Normal[iDim] <<
"\t";
370 u[0]=(3.0/(x[1]-x[0]))*((y[1]-y[0])/(x[1]-x[0])-yp1);
373 for (i=2; i<=n-1; i++) {
374 sig=(x[i-1]-x[i-2])/(x[i]-x[i-2]);
378 su2double a1 = (y[i]-y[i-1])/(x[i]-x[i-1]);
if (x[i] == x[i-1]) a1 = 1.0;
379 su2double a2 = (y[i-1]-y[i-2])/(x[i-1]-x[i-2]);
if (x[i-1] == x[i-2]) a2 = 1.0;
381 u[i-1]=(6.0*u[i-1]/(x[i]-x[i-2])-sig*u[i-2])/p;
389 un=(3.0/(x[n-1]-x[n-2]))*(ypn-(y[n-1]-y[n-2])/(x[n-1]-x[n-2]));
391 y2[n-1]=(un-qn*u[n-2])/(qn*y2[n-2]+1.0);
392 for (k=n-1; k>=1; k--)
393 y2[k-1]=y2[k-1]*y2[k]+u[k-1];
400 unsigned long klo, khi, k;
403 if (x < xa[0]) x = xa[0];
404 if (x > xa[n-1]) x = xa[n-1];
408 while (khi-klo > 1) {
410 if (xa[k-1] > x) khi = k;
413 h = xa[khi-1] - xa[klo-1];
414 if (h == 0.0) h =
EPS;
417 y = a*ya[klo-1]+b*ya[khi-1]+((a*a*a-a)*y2a[klo-1]+(b*b*b-b)*y2a[khi-1])*(h*h)/6.0;
424 su2double u[3], v[3], Denominator, Numerator, Aux, ModU;
428 for (iDim = 0; iDim < 3; iDim++) {
429 u[iDim] = Segment_P1[iDim] - Segment_P0[iDim];
430 v[iDim] = (Plane_P0[iDim]+epsilon) - Segment_P0[iDim];
433 ModU = sqrt(u[0]*u[0]+u[1]*u[1]+u[2]*u[2]);
435 Numerator = (Plane_Normal[0]+epsilon)*v[0] + (Plane_Normal[1]+epsilon)*v[1] + (Plane_Normal[2]+epsilon)*v[2];
436 Denominator = (Plane_Normal[0]+epsilon)*u[0] + (Plane_Normal[1]+epsilon)*u[1] + (Plane_Normal[2]+epsilon)*u[2];
438 if (fabs(Denominator) <= 0.0)
return (
false);
440 Aux = Numerator / Denominator;
442 if (Aux < 0.0 || Aux > 1.0)
return (
false);
444 for (iDim = 0; iDim < 3; iDim++)
445 Intersection[iDim] = Segment_P0[iDim] + Aux * u[iDim];
450 for (iDim = 0; iDim < 3; iDim++) {
451 u[iDim] = Segment_P0[iDim] - Intersection[iDim];
452 v[iDim] = Segment_P1[iDim] - Intersection[iDim];
455 Variable_Interp = Variable_P0 + (Variable_P1 - Variable_P0)*sqrt(u[0]*u[0]+u[1]*u[1]+u[2]*u[2])/ModU;
457 Denominator = (Plane_Normal[0]+epsilon)*u[0] + (Plane_Normal[1]+epsilon)*u[1] + (Plane_Normal[2]+epsilon)*u[2];
458 Numerator = (Plane_Normal[0]+epsilon)*v[0] + (Plane_Normal[1]+epsilon)*v[1] + (Plane_Normal[2]+epsilon)*v[2];
460 Aux = Numerator * Denominator;
462 if (Aux > 0.0)
return (
false);
472 su2double edge1[3], edge2[3], tvec[3], pvec[3], qvec[3];
477 SUB(edge1, vert1, vert0);
478 SUB(edge2, vert2, vert0);
482 CROSS(pvec, dir, edge2);
486 det =
DOT(edge1, pvec);
495 SUB(tvec, orig, vert0);
499 u = inv_det *
DOT(tvec, pvec);
501 if (u < 0.0 || u > 1.0)
return(
false);
505 CROSS(qvec, tvec, edge1);
509 v = inv_det *
DOT(dir, qvec);
511 if (v < 0.0 || u + v > 1.0)
return(
false);
515 t = inv_det *
DOT(edge2, qvec);
519 intersect[0] = orig[0] + (t * dir[0]);
520 intersect[1] = orig[1] + (t * dir[1]);
521 intersect[2] = orig[2] + (t * dir[2]);
529 su2double det, diff0_A, diff0_B, diff1_A, diff1_B, intersect[2];
531 diff0_A = point0[0] - point1[0];
532 diff1_A = point0[1] - point1[1];
534 diff0_B = vert0[0] - vert1[0];
535 diff1_B = vert0[1] - vert1[1];
537 det = (diff0_A)*(diff1_B) - (diff1_A)*(diff0_B);
539 if (det == 0)
return false;
543 intersect[0] = ((point0[0]*point1[1] - point0[1]*point1[0])*diff0_B
544 -(vert0[0]* vert1[1] - vert0[1]* vert1[0])*diff0_A)/det;
546 intersect[1] = ((point0[0]*point1[1] - point0[1]*point1[0])*diff1_B
547 -(vert0[0]* vert1[1] - vert0[1]* vert1[0])*diff1_A)/det;
554 dist0 = (intersect[0] - point0[0])*(intersect[0] - point0[0])
555 +(intersect[1] - point0[1])*(intersect[1] - point0[1]);
557 dist1 = (intersect[0] - point1[0])*(intersect[0] - point1[0])
558 +(intersect[1] - point1[1])*(intersect[1] - point1[1]);
560 length = diff0_A*diff0_A
563 if ( (dist0 > length) || (dist1 > length) ) {
573 su2double dir[3], intersect[3], u[3], v[3], edge1[3], edge2[3], Plane_Normal[3], Denominator, Numerator, Aux;
575 SUB(dir, point1, point0);
581 SUB(u, point0, intersect);
582 SUB(v, point1, intersect);
584 SUB(edge1, vert1, vert0);
585 SUB(edge2, vert2, vert0);
586 CROSS(Plane_Normal, edge1, edge2);
588 Denominator =
DOT(Plane_Normal, u);
589 Numerator =
DOT(Plane_Normal, v);
591 Aux = Numerator * Denominator;
595 if (Aux > 0.0)
return (
false);
617 vector<su2double> &Xcoord_Airfoil, vector<su2double> &Ycoord_Airfoil,
618 vector<su2double> &Zcoord_Airfoil, vector<su2double> &Variable_Airfoil,
619 bool original_surface,
CConfig *config) {
623 unsigned short iMarker, iNode, jNode, iDim, Index = 0;
626 unsigned long iPoint, jPoint, iElem, Trailing_Point, Airfoil_Point, iVertex, iEdge, PointIndex, jEdge;
627 su2double Segment_P0[3] = {0.0, 0.0, 0.0}, Segment_P1[3] = {0.0, 0.0, 0.0}, Variable_P0 = 0.0, Variable_P1 = 0.0, Intersection[3] = {0.0, 0.0, 0.0}, Trailing_Coord,
628 *VarCoord = NULL, Variable_Interp, v1[3] = {0.0, 0.0, 0.0}, v3[3] = {0.0, 0.0, 0.0}, CrossProduct = 1.0;
631 vector<su2double> Xcoord_Index0, Ycoord_Index0, Zcoord_Index0, Variable_Index0, Xcoord_Index1, Ycoord_Index1, Zcoord_Index1, Variable_Index1;
632 vector<unsigned long> IGlobalID_Index0, JGlobalID_Index0, IGlobalID_Index1, JGlobalID_Index1, IGlobalID_Airfoil, JGlobalID_Airfoil;
633 vector<unsigned short> Conection_Index0, Conection_Index1;
634 vector<unsigned long> Duplicate;
635 vector<unsigned long>::iterator it;
637 vector<su2double> XcoordExtra, YcoordExtra, ZcoordExtra, VariableExtra;
638 vector<unsigned long> IGlobalIDExtra, JGlobalIDExtra;
639 vector<bool> AddExtra;
640 unsigned long EdgeDonor;
644 unsigned long nLocalEdge, MaxLocalEdge, *Buffer_Send_nEdge, *Buffer_Receive_nEdge, nBuffer_Coord, nBuffer_Variable, nBuffer_GlobalID;
645 int nProcessor, iProcessor;
646 su2double *Buffer_Send_Coord, *Buffer_Receive_Coord;
647 su2double *Buffer_Send_Variable, *Buffer_Receive_Variable;
648 unsigned long *Buffer_Send_GlobalID, *Buffer_Receive_GlobalID;
651 Xcoord_Airfoil.clear();
652 Ycoord_Airfoil.clear();
653 Zcoord_Airfoil.clear();
654 Variable_Airfoil.clear();
655 IGlobalID_Airfoil.clear();
656 JGlobalID_Airfoil.clear();
661 Plane_P0[0] = 0.0; Plane_P0[1] = 0.0; Plane_P0[2] = 0.0;
662 Plane_Normal[0] = 0.0; Plane_Normal[1] = 1.0; Plane_Normal[2] = 0.0;
668 if (original_surface ==
false) {
671 for (iPoint = 0; iPoint <
nPoint; iPoint++)
674 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
676 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
679 for (iDim = 0; iDim <
nDim; iDim++)
680 Coord_Variation[iPoint][iDim] = VarCoord[iDim];
687 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
691 for (iElem = 0; iElem <
nElem_Bound[iMarker]; iElem++) {
702 for (iNode = 0; iNode <
bound[iMarker][iElem]->
GetnNodes(); iNode++) {
732 su2double XCoord_Trans_Tilt = XCoord_Trans*cos(Tilt_Angle) + ZCoord_Trans*sin(Tilt_Angle);
733 su2double YCoord_Trans_Tilt = YCoord_Trans;
734 su2double ZCoord_Trans_Tilt = ZCoord_Trans*cos(Tilt_Angle) - XCoord_Trans*sin(Tilt_Angle);
738 su2double YCoord_Trans_Tilt_Toe = XCoord_Trans_Tilt*sin(Toe_Angle) + YCoord_Trans_Tilt*cos(Toe_Angle);
739 su2double ZCoord_Trans_Tilt_Toe = ZCoord_Trans_Tilt;
745 su2double XPlane_Normal_Tilt = Plane_Normal[0]*cos(-Tilt_Angle) + Plane_Normal[2]*sin(-Tilt_Angle);
746 su2double YPlane_Normal_Tilt = Plane_Normal[1];
747 su2double ZPlane_Normal_Tilt = Plane_Normal[2]*cos(-Tilt_Angle) - Plane_Normal[0]*sin(-Tilt_Angle);
751 su2double YPlane_Normal_Tilt_Toe = XPlane_Normal_Tilt*sin(-Toe_Angle) + YPlane_Normal_Tilt*cos(-Toe_Angle);
752 su2double ZPlane_Normal_Tilt_Toe = ZPlane_Normal_Tilt;
755 v1[1] = YCoord_Trans_Tilt_Toe - 0.0;
756 v1[2] = ZCoord_Trans_Tilt_Toe - 0.0;
757 v3[0] = v1[1]*ZPlane_Normal_Tilt_Toe-v1[2]*YPlane_Normal_Tilt_Toe;
758 CrossProduct = v3[0] * 1.0;
762 for (iNode = 0; iNode <
bound[iMarker][iElem]->
GetnNodes(); iNode++) {
765 for (jNode = 0; jNode <
bound[iMarker][iElem]->
GetnNodes(); jNode++) {
772 if ((jPoint > iPoint) && (CrossProduct >= 0.0)
773 && ((AveXCoord > MinXCoord) && (AveXCoord < MaxXCoord))
774 && ((AveYCoord > MinYCoord) && (AveYCoord < MaxYCoord))
775 && ((AveZCoord > MinZCoord) && (AveZCoord < MaxZCoord))) {
777 Segment_P0[0] = 0.0; Segment_P0[1] = 0.0; Segment_P0[2] = 0.0; Variable_P0 = 0.0;
778 Segment_P1[0] = 0.0; Segment_P1[1] = 0.0; Segment_P1[2] = 0.0; Variable_P1 = 0.0;
781 for (iDim = 0; iDim <
nDim; iDim++) {
782 if (original_surface ==
true) {
787 Segment_P0[iDim] =
node[iPoint]->
GetCoord(iDim) + Coord_Variation[iPoint][iDim];
788 Segment_P1[iDim] =
node[jPoint]->
GetCoord(iDim) + Coord_Variation[jPoint][iDim];
792 if (FlowVariable != NULL) {
793 Variable_P0 = FlowVariable[iPoint];
794 Variable_P1 = FlowVariable[jPoint];
800 Xcoord_Index0.push_back(Segment_P0[0]); Xcoord_Index1.push_back(Segment_P1[0]);
801 Ycoord_Index0.push_back(Segment_P0[2]); Ycoord_Index1.push_back(Segment_P1[2]);
802 Zcoord_Index0.push_back(Segment_P0[1]); Zcoord_Index1.push_back(Segment_P1[1]);
803 Variable_Index0.push_back(Variable_P0); Variable_Index1.push_back(Variable_P1);
804 IGlobalID_Index0.push_back(
node[iPoint]->GetGlobalIndex()); IGlobalID_Index1.push_back(
node[jPoint]->GetGlobalIndex());
805 JGlobalID_Index0.push_back(
node[iPoint]->GetGlobalIndex()); JGlobalID_Index1.push_back(
node[jPoint]->GetGlobalIndex());
811 else if (
nDim == 3) {
812 intersect =
SegmentIntersectsPlane(Segment_P0, Segment_P1, Variable_P0, Variable_P1, Plane_P0, Plane_Normal, Intersection, Variable_Interp);
813 if (intersect ==
true) {
814 if (PointIndex == 0) {
815 Xcoord_Index0.push_back(Intersection[0]);
816 Ycoord_Index0.push_back(Intersection[1]);
817 Zcoord_Index0.push_back(Intersection[2]);
818 Variable_Index0.push_back(Variable_Interp);
819 IGlobalID_Index0.push_back(
node[iPoint]->GetGlobalIndex());
820 JGlobalID_Index0.push_back(
node[jPoint]->GetGlobalIndex());
822 if (PointIndex == 1) {
823 Xcoord_Index1.push_back(Intersection[0]);
824 Ycoord_Index1.push_back(Intersection[1]);
825 Zcoord_Index1.push_back(Intersection[2]);
826 Variable_Index1.push_back(Variable_Interp);
827 IGlobalID_Index1.push_back(
node[iPoint]->GetGlobalIndex());
828 JGlobalID_Index1.push_back(
node[jPoint]->GetGlobalIndex());
842 if (original_surface ==
false) {
843 for (iPoint = 0; iPoint <
nPoint; iPoint++)
844 delete [] Coord_Variation[iPoint];
845 delete [] Coord_Variation;
852 nLocalEdge = 0, MaxLocalEdge = 0;
855 Buffer_Send_nEdge =
new unsigned long [1];
856 Buffer_Receive_nEdge =
new unsigned long [nProcessor];
858 nLocalEdge = Xcoord_Index0.size();
860 Buffer_Send_nEdge[0] = nLocalEdge;
865 Buffer_Send_Coord =
new su2double [MaxLocalEdge*6];
866 Buffer_Receive_Coord =
new su2double [nProcessor*MaxLocalEdge*6];
868 Buffer_Send_Variable =
new su2double [MaxLocalEdge*2];
869 Buffer_Receive_Variable =
new su2double [nProcessor*MaxLocalEdge*2];
871 Buffer_Send_GlobalID =
new unsigned long [MaxLocalEdge*4];
872 Buffer_Receive_GlobalID =
new unsigned long [nProcessor*MaxLocalEdge*4];
874 nBuffer_Coord = MaxLocalEdge*6;
875 nBuffer_Variable = MaxLocalEdge*2;
876 nBuffer_GlobalID = MaxLocalEdge*4;
878 for (iEdge = 0; iEdge < nLocalEdge; iEdge++) {
879 Buffer_Send_Coord[iEdge*6 + 0] = Xcoord_Index0[iEdge];
880 Buffer_Send_Coord[iEdge*6 + 1] = Ycoord_Index0[iEdge];
881 Buffer_Send_Coord[iEdge*6 + 2] = Zcoord_Index0[iEdge];
882 Buffer_Send_Coord[iEdge*6 + 3] = Xcoord_Index1[iEdge];
883 Buffer_Send_Coord[iEdge*6 + 4] = Ycoord_Index1[iEdge];
884 Buffer_Send_Coord[iEdge*6 + 5] = Zcoord_Index1[iEdge];
886 Buffer_Send_Variable[iEdge*2 + 0] = Variable_Index0[iEdge];
887 Buffer_Send_Variable[iEdge*2 + 1] = Variable_Index1[iEdge];
889 Buffer_Send_GlobalID[iEdge*4 + 0] = IGlobalID_Index0[iEdge];
890 Buffer_Send_GlobalID[iEdge*4 + 1] = JGlobalID_Index0[iEdge];
891 Buffer_Send_GlobalID[iEdge*4 + 2] = IGlobalID_Index1[iEdge];
892 Buffer_Send_GlobalID[iEdge*4 + 3] = JGlobalID_Index1[iEdge];
901 Xcoord_Index0.clear(); Xcoord_Index1.clear();
902 Ycoord_Index0.clear(); Ycoord_Index1.clear();
903 Zcoord_Index0.clear(); Zcoord_Index1.clear();
904 Variable_Index0.clear(); Variable_Index1.clear();
905 IGlobalID_Index0.clear(); IGlobalID_Index1.clear();
906 JGlobalID_Index0.clear(); JGlobalID_Index1.clear();
911 for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) {
912 for (iEdge = 0; iEdge < Buffer_Receive_nEdge[iProcessor]; iEdge++) {
913 Xcoord_Index0.push_back( Buffer_Receive_Coord[ iProcessor*MaxLocalEdge*6 + iEdge*6 + 0] );
914 Ycoord_Index0.push_back( Buffer_Receive_Coord[ iProcessor*MaxLocalEdge*6 + iEdge*6 + 1] );
915 Zcoord_Index0.push_back( Buffer_Receive_Coord[ iProcessor*MaxLocalEdge*6 + iEdge*6 + 2] );
916 Xcoord_Index1.push_back( Buffer_Receive_Coord[ iProcessor*MaxLocalEdge*6 + iEdge*6 + 3] );
917 Ycoord_Index1.push_back( Buffer_Receive_Coord[ iProcessor*MaxLocalEdge*6 + iEdge*6 + 4] );
918 Zcoord_Index1.push_back( Buffer_Receive_Coord[ iProcessor*MaxLocalEdge*6 + iEdge*6 + 5] );
920 Variable_Index0.push_back( Buffer_Receive_Variable[ iProcessor*MaxLocalEdge*2 + iEdge*2 + 0] );
921 Variable_Index1.push_back( Buffer_Receive_Variable[ iProcessor*MaxLocalEdge*2 + iEdge*2 + 1] );
923 IGlobalID_Index0.push_back( Buffer_Receive_GlobalID[ iProcessor*MaxLocalEdge*4 + iEdge*4 + 0] );
924 JGlobalID_Index0.push_back( Buffer_Receive_GlobalID[ iProcessor*MaxLocalEdge*4 + iEdge*4 + 1] );
925 IGlobalID_Index1.push_back( Buffer_Receive_GlobalID[ iProcessor*MaxLocalEdge*4 + iEdge*4 + 2] );
926 JGlobalID_Index1.push_back( Buffer_Receive_GlobalID[ iProcessor*MaxLocalEdge*4 + iEdge*4 + 3] );
932 delete[] Buffer_Send_Coord;
delete[] Buffer_Receive_Coord;
933 delete[] Buffer_Send_Variable;
delete[] Buffer_Receive_Variable;
934 delete[] Buffer_Send_GlobalID;
delete[] Buffer_Receive_GlobalID;
935 delete[] Buffer_Send_nEdge;
delete[] Buffer_Receive_nEdge;
946 for (iEdge = 0; iEdge < Xcoord_Index0.size(); iEdge++) {
948 if (((IGlobalID_Index0[iEdge] == IGlobalID_Index1[iEdge]) && (JGlobalID_Index0[iEdge] == JGlobalID_Index1[iEdge])) ||
949 ((IGlobalID_Index0[iEdge] == JGlobalID_Index1[iEdge]) && (JGlobalID_Index0[iEdge] == IGlobalID_Index1[iEdge]))) {
951 Xcoord_Index0.erase (Xcoord_Index0.begin() + iEdge);
952 Ycoord_Index0.erase (Ycoord_Index0.begin() + iEdge);
953 Zcoord_Index0.erase (Zcoord_Index0.begin() + iEdge);
954 Variable_Index0.erase (Variable_Index0.begin() + iEdge);
955 IGlobalID_Index0.erase (IGlobalID_Index0.begin() + iEdge);
956 JGlobalID_Index0.erase (JGlobalID_Index0.begin() + iEdge);
958 Xcoord_Index1.erase (Xcoord_Index1.begin() + iEdge);
959 Ycoord_Index1.erase (Ycoord_Index1.begin() + iEdge);
960 Zcoord_Index1.erase (Zcoord_Index1.begin() + iEdge);
961 Variable_Index1.erase (Variable_Index1.begin() + iEdge);
962 IGlobalID_Index1.erase (IGlobalID_Index1.begin() + iEdge);
963 JGlobalID_Index1.erase (JGlobalID_Index1.begin() + iEdge);
965 Remove =
true;
break;
969 }
while (Remove ==
true);
974 for (iEdge = 0; iEdge < Xcoord_Index0.size()-1; iEdge++) {
975 for (jEdge = iEdge+1; jEdge < Xcoord_Index0.size(); jEdge++) {
979 if ((((IGlobalID_Index0[iEdge] == IGlobalID_Index0[jEdge]) && (JGlobalID_Index0[iEdge] == JGlobalID_Index0[jEdge])) ||
980 ((IGlobalID_Index0[iEdge] == JGlobalID_Index0[jEdge]) && (JGlobalID_Index0[iEdge] == IGlobalID_Index0[jEdge]))) &&
981 (((IGlobalID_Index1[iEdge] == IGlobalID_Index1[jEdge]) && (JGlobalID_Index1[iEdge] == JGlobalID_Index1[jEdge])) ||
982 ((IGlobalID_Index1[iEdge] == JGlobalID_Index1[jEdge]) && (JGlobalID_Index1[iEdge] == IGlobalID_Index1[jEdge])))) {
984 Xcoord_Index0.erase (Xcoord_Index0.begin() + jEdge);
985 Ycoord_Index0.erase (Ycoord_Index0.begin() + jEdge);
986 Zcoord_Index0.erase (Zcoord_Index0.begin() + jEdge);
987 Variable_Index0.erase (Variable_Index0.begin() + jEdge);
988 IGlobalID_Index0.erase (IGlobalID_Index0.begin() + jEdge);
989 JGlobalID_Index0.erase (JGlobalID_Index0.begin() + jEdge);
991 Xcoord_Index1.erase (Xcoord_Index1.begin() + jEdge);
992 Ycoord_Index1.erase (Ycoord_Index1.begin() + jEdge);
993 Zcoord_Index1.erase (Zcoord_Index1.begin() + jEdge);
994 Variable_Index1.erase (Variable_Index1.begin() + jEdge);
995 IGlobalID_Index1.erase (IGlobalID_Index1.begin() + jEdge);
996 JGlobalID_Index1.erase (JGlobalID_Index1.begin() + jEdge);
998 Remove =
true;
break;
1004 if ((((IGlobalID_Index0[iEdge] == IGlobalID_Index1[jEdge]) && (JGlobalID_Index0[iEdge] == JGlobalID_Index1[jEdge])) ||
1005 ((IGlobalID_Index0[iEdge] == JGlobalID_Index1[jEdge]) && (JGlobalID_Index0[iEdge] == IGlobalID_Index1[jEdge]))) &&
1006 (((IGlobalID_Index1[iEdge] == IGlobalID_Index0[jEdge]) && (JGlobalID_Index1[iEdge] == JGlobalID_Index0[jEdge])) ||
1007 ((IGlobalID_Index1[iEdge] == JGlobalID_Index0[jEdge]) && (JGlobalID_Index1[iEdge] == IGlobalID_Index0[jEdge])))) {
1009 Xcoord_Index0.erase (Xcoord_Index0.begin() + jEdge);
1010 Ycoord_Index0.erase (Ycoord_Index0.begin() + jEdge);
1011 Zcoord_Index0.erase (Zcoord_Index0.begin() + jEdge);
1012 Variable_Index0.erase (Variable_Index0.begin() + jEdge);
1013 IGlobalID_Index0.erase (IGlobalID_Index0.begin() + jEdge);
1014 JGlobalID_Index0.erase (JGlobalID_Index0.begin() + jEdge);
1016 Xcoord_Index1.erase (Xcoord_Index1.begin() + jEdge);
1017 Ycoord_Index1.erase (Ycoord_Index1.begin() + jEdge);
1018 Zcoord_Index1.erase (Zcoord_Index1.begin() + jEdge);
1019 Variable_Index1.erase (Variable_Index1.begin() + jEdge);
1020 IGlobalID_Index1.erase (IGlobalID_Index1.begin() + jEdge);
1021 JGlobalID_Index1.erase (JGlobalID_Index1.begin() + jEdge);
1023 Remove =
true;
break;
1030 }
while (Remove ==
true);
1032 if (Xcoord_Index0.size() != 1) {
1038 for (iEdge = 0; iEdge < Xcoord_Index0.size(); iEdge++) {
1039 su2double XCoord = Xcoord_Index0[iEdge]*cos(Angle) - Ycoord_Index0[iEdge]*sin(Angle);
1040 su2double YCoord = Ycoord_Index0[iEdge]*cos(Angle) + Xcoord_Index0[iEdge]*sin(Angle);
1041 su2double ZCoord = Zcoord_Index0[iEdge];
1042 Xcoord_Index0[iEdge] = XCoord; Ycoord_Index0[iEdge] = YCoord; Zcoord_Index0[iEdge] = ZCoord;
1043 XCoord = Xcoord_Index1[iEdge]*cos(Angle) - Ycoord_Index1[iEdge]*sin(Angle);
1044 YCoord = Ycoord_Index1[iEdge]*cos(Angle) + Xcoord_Index1[iEdge]*sin(Angle);
1045 ZCoord = Zcoord_Index1[iEdge];
1046 Xcoord_Index1[iEdge] = XCoord; Ycoord_Index1[iEdge] = YCoord; Zcoord_Index1[iEdge] = ZCoord;
1060 su2double XCoord_Trans, YCoord_Trans, ZCoord_Trans, XCoord_Trans_Tilt, YCoord_Trans_Tilt, ZCoord_Trans_Tilt,
1061 XCoord_Trans_Tilt_Toe, YCoord_Trans_Tilt_Toe, ZCoord_Trans_Tilt_Toe, XCoord, YCoord, ZCoord;
1063 for (iEdge = 0; iEdge < Xcoord_Index0.size(); iEdge++) {
1075 XCoord_Trans_Tilt = XCoord_Trans*cos(Tilt_Angle) + ZCoord_Trans*sin(Tilt_Angle);
1076 YCoord_Trans_Tilt = YCoord_Trans;
1077 ZCoord_Trans_Tilt = ZCoord_Trans*cos(Tilt_Angle) - XCoord_Trans*sin(Tilt_Angle);
1081 XCoord_Trans_Tilt_Toe = XCoord_Trans_Tilt*cos(Toe_Angle) - YCoord_Trans_Tilt*sin(Toe_Angle);
1082 YCoord_Trans_Tilt_Toe = XCoord_Trans_Tilt*sin(Toe_Angle) + YCoord_Trans_Tilt*cos(Toe_Angle);
1083 ZCoord_Trans_Tilt_Toe = ZCoord_Trans_Tilt;
1087 XCoord = XCoord_Trans_Tilt_Toe;
1088 YCoord = YCoord_Trans_Tilt_Toe*cos(Roll_Angle) - ZCoord_Trans_Tilt_Toe*sin(Roll_Angle);
1089 ZCoord = YCoord_Trans_Tilt_Toe*sin(Roll_Angle) + ZCoord_Trans_Tilt_Toe*cos(Roll_Angle);
1093 Xcoord_Index0[iEdge] = XCoord; Ycoord_Index0[iEdge] = YCoord; Zcoord_Index0[iEdge] = ZCoord;
1105 XCoord_Trans_Tilt = XCoord_Trans*cos(Tilt_Angle) + ZCoord_Trans*sin(Tilt_Angle);
1106 YCoord_Trans_Tilt = YCoord_Trans;
1107 ZCoord_Trans_Tilt = ZCoord_Trans*cos(Tilt_Angle) - XCoord_Trans*sin(Tilt_Angle);
1111 XCoord_Trans_Tilt_Toe = XCoord_Trans_Tilt*cos(Toe_Angle) - YCoord_Trans_Tilt*sin(Toe_Angle);
1112 YCoord_Trans_Tilt_Toe = XCoord_Trans_Tilt*sin(Toe_Angle) + YCoord_Trans_Tilt*cos(Toe_Angle);
1113 ZCoord_Trans_Tilt_Toe = ZCoord_Trans_Tilt;
1117 XCoord = XCoord_Trans_Tilt_Toe;
1118 YCoord = YCoord_Trans_Tilt_Toe*cos(Roll_Angle) - ZCoord_Trans_Tilt_Toe*sin(Roll_Angle);
1119 ZCoord = YCoord_Trans_Tilt_Toe*sin(Roll_Angle) + ZCoord_Trans_Tilt_Toe*cos(Roll_Angle);
1123 Xcoord_Index1[iEdge] = XCoord; Ycoord_Index1[iEdge] = YCoord; Zcoord_Index1[iEdge] = ZCoord;
1131 Conection_Index0.reserve(Xcoord_Index0.size()+1);
1132 Conection_Index1.reserve(Xcoord_Index0.size()+1);
1134 for (iEdge = 0; iEdge < Xcoord_Index0.size(); iEdge++) {
1135 Conection_Index0[iEdge] = 0;
1136 Conection_Index1[iEdge] = 0;
1139 for (iEdge = 0; iEdge < Xcoord_Index0.size()-1; iEdge++) {
1140 for (jEdge = iEdge+1; jEdge < Xcoord_Index0.size(); jEdge++) {
1142 if (((IGlobalID_Index0[iEdge] == IGlobalID_Index0[jEdge]) && (JGlobalID_Index0[iEdge] == JGlobalID_Index0[jEdge])) ||
1143 ((IGlobalID_Index0[iEdge] == JGlobalID_Index0[jEdge]) && (JGlobalID_Index0[iEdge] == IGlobalID_Index0[jEdge])))
1144 { Conection_Index0[iEdge]++; Conection_Index0[jEdge]++; }
1146 if (((IGlobalID_Index0[iEdge] == IGlobalID_Index1[jEdge]) && (JGlobalID_Index0[iEdge] == JGlobalID_Index1[jEdge])) ||
1147 ((IGlobalID_Index0[iEdge] == JGlobalID_Index1[jEdge]) && (JGlobalID_Index0[iEdge] == IGlobalID_Index1[jEdge])))
1148 { Conection_Index0[iEdge]++; Conection_Index1[jEdge]++; }
1150 if (((IGlobalID_Index1[iEdge] == IGlobalID_Index0[jEdge]) && (JGlobalID_Index1[iEdge] == JGlobalID_Index0[jEdge])) ||
1151 ((IGlobalID_Index1[iEdge] == JGlobalID_Index0[jEdge]) && (JGlobalID_Index1[iEdge] == IGlobalID_Index0[jEdge])))
1152 { Conection_Index1[iEdge]++; Conection_Index0[jEdge]++; }
1154 if (((IGlobalID_Index1[iEdge] == IGlobalID_Index1[jEdge]) && (JGlobalID_Index1[iEdge] == JGlobalID_Index1[jEdge])) ||
1155 ((IGlobalID_Index1[iEdge] == JGlobalID_Index1[jEdge]) && (JGlobalID_Index1[iEdge] == IGlobalID_Index1[jEdge])))
1156 { Conection_Index1[iEdge]++; Conection_Index1[jEdge]++; }
1165 for (iEdge = 0; iEdge < Xcoord_Index0.size(); iEdge++) {
1166 if (Conection_Index0[iEdge] == 0) {
1167 XcoordExtra.push_back(Xcoord_Index0[iEdge]);
1168 YcoordExtra.push_back(Ycoord_Index0[iEdge]);
1169 ZcoordExtra.push_back(Zcoord_Index0[iEdge]);
1170 VariableExtra.push_back(Variable_Index0[iEdge]);
1171 IGlobalIDExtra.push_back(IGlobalID_Index0[iEdge]);
1172 JGlobalIDExtra.push_back(JGlobalID_Index0[iEdge]);
1173 AddExtra.push_back(
true);
1175 if (Conection_Index1[iEdge] == 0) {
1176 XcoordExtra.push_back(Xcoord_Index1[iEdge]);
1177 YcoordExtra.push_back(Ycoord_Index1[iEdge]);
1178 ZcoordExtra.push_back(Zcoord_Index1[iEdge]);
1179 VariableExtra.push_back(Variable_Index1[iEdge]);
1180 IGlobalIDExtra.push_back(IGlobalID_Index1[iEdge]);
1181 JGlobalIDExtra.push_back(JGlobalID_Index1[iEdge]);
1182 AddExtra.push_back(
true);
1188 if (XcoordExtra.size() > 1) {
1190 for (iEdge = 0; iEdge < XcoordExtra.size()-1; iEdge++) {
1192 su2double MinDist = 1E6; FoundEdge =
false; EdgeDonor = 0;
1193 for (jEdge = iEdge+1; jEdge < XcoordExtra.size(); jEdge++) {
1195 if ((Dist_Value < MinDist) && (AddExtra[iEdge]) && (AddExtra[jEdge])) {
1196 EdgeDonor = jEdge; FoundEdge =
true;
1204 Xcoord_Index0.push_back (XcoordExtra[iEdge]);
1205 Ycoord_Index0.push_back (YcoordExtra[iEdge]);
1206 Zcoord_Index0.push_back (ZcoordExtra[iEdge]);
1207 Variable_Index0.push_back (VariableExtra[iEdge]);
1208 IGlobalID_Index0.push_back (IGlobalIDExtra[iEdge]);
1209 JGlobalID_Index0.push_back (JGlobalIDExtra[iEdge]);
1210 AddExtra[iEdge] =
false;
1214 Xcoord_Index1.push_back (XcoordExtra[EdgeDonor]);
1215 Ycoord_Index1.push_back (YcoordExtra[EdgeDonor]);
1216 Zcoord_Index1.push_back (ZcoordExtra[EdgeDonor]);
1217 Variable_Index1.push_back (VariableExtra[EdgeDonor]);
1218 IGlobalID_Index1.push_back (IGlobalIDExtra[EdgeDonor]);
1219 JGlobalID_Index1.push_back (JGlobalIDExtra[EdgeDonor]);
1220 AddExtra[EdgeDonor] =
false;
1228 else if (XcoordExtra.size() == 1) {
1229 cout <<
"There cutting system has failed, there is an incomplete curve (not used)." << endl;
1235 Trailing_Point = 0; Trailing_Coord = Xcoord_Index0[0];
1236 for (iEdge = 1; iEdge < Xcoord_Index0.size(); iEdge++) {
1237 if (Xcoord_Index0[iEdge] > Trailing_Coord) {
1238 Trailing_Point = iEdge; Trailing_Coord = Xcoord_Index0[iEdge];
1242 Xcoord_Airfoil.push_back(Xcoord_Index0[Trailing_Point]);
1243 Ycoord_Airfoil.push_back(Ycoord_Index0[Trailing_Point]);
1244 Zcoord_Airfoil.push_back(Zcoord_Index0[Trailing_Point]);
1245 Variable_Airfoil.push_back(Variable_Index0[Trailing_Point]);
1246 IGlobalID_Airfoil.push_back(IGlobalID_Index0[Trailing_Point]);
1247 JGlobalID_Airfoil.push_back(JGlobalID_Index0[Trailing_Point]);
1249 Xcoord_Airfoil.push_back(Xcoord_Index1[Trailing_Point]);
1250 Ycoord_Airfoil.push_back(Ycoord_Index1[Trailing_Point]);
1251 Zcoord_Airfoil.push_back(Zcoord_Index1[Trailing_Point]);
1252 Variable_Airfoil.push_back(Variable_Index1[Trailing_Point]);
1253 IGlobalID_Airfoil.push_back(IGlobalID_Index1[Trailing_Point]);
1254 JGlobalID_Airfoil.push_back(JGlobalID_Index1[Trailing_Point]);
1256 Xcoord_Index0.erase (Xcoord_Index0.begin() + Trailing_Point);
1257 Ycoord_Index0.erase (Ycoord_Index0.begin() + Trailing_Point);
1258 Zcoord_Index0.erase (Zcoord_Index0.begin() + Trailing_Point);
1259 Variable_Index0.erase (Variable_Index0.begin() + Trailing_Point);
1260 IGlobalID_Index0.erase (IGlobalID_Index0.begin() + Trailing_Point);
1261 JGlobalID_Index0.erase (JGlobalID_Index0.begin() + Trailing_Point);
1263 Xcoord_Index1.erase (Xcoord_Index1.begin() + Trailing_Point);
1264 Ycoord_Index1.erase (Ycoord_Index1.begin() + Trailing_Point);
1265 Zcoord_Index1.erase (Zcoord_Index1.begin() + Trailing_Point);
1266 Variable_Index1.erase (Variable_Index1.begin() + Trailing_Point);
1267 IGlobalID_Index1.erase (IGlobalID_Index1.begin() + Trailing_Point);
1268 JGlobalID_Index1.erase (JGlobalID_Index1.begin() + Trailing_Point);
1277 Airfoil_Point = Xcoord_Airfoil.size() - 1;
1283 for (iEdge = 0; iEdge < Xcoord_Index0.size(); iEdge++) {
1285 if (((IGlobalID_Index0[iEdge] == IGlobalID_Airfoil[Airfoil_Point]) && (JGlobalID_Index0[iEdge] == JGlobalID_Airfoil[Airfoil_Point])) ||
1286 ((IGlobalID_Index0[iEdge] == JGlobalID_Airfoil[Airfoil_Point]) && (JGlobalID_Index0[iEdge] == IGlobalID_Airfoil[Airfoil_Point]))) {
1287 Next_Edge = iEdge; Found_Edge =
true; Index = 0;
break;
1290 if (((IGlobalID_Index1[iEdge] == IGlobalID_Airfoil[Airfoil_Point]) && (JGlobalID_Index1[iEdge] == JGlobalID_Airfoil[Airfoil_Point])) ||
1291 ((IGlobalID_Index1[iEdge] == JGlobalID_Airfoil[Airfoil_Point]) && (JGlobalID_Index1[iEdge] == IGlobalID_Airfoil[Airfoil_Point]))) {
1292 Next_Edge = iEdge; Found_Edge =
true; Index = 1;
break;
1302 Xcoord_Airfoil.push_back(Xcoord_Index1[Next_Edge]);
1303 Ycoord_Airfoil.push_back(Ycoord_Index1[Next_Edge]);
1304 Zcoord_Airfoil.push_back(Zcoord_Index1[Next_Edge]);
1305 Variable_Airfoil.push_back(Variable_Index1[Next_Edge]);
1306 IGlobalID_Airfoil.push_back(IGlobalID_Index1[Next_Edge]);
1307 JGlobalID_Airfoil.push_back(JGlobalID_Index1[Next_Edge]);
1311 Xcoord_Airfoil.push_back(Xcoord_Index0[Next_Edge]);
1312 Ycoord_Airfoil.push_back(Ycoord_Index0[Next_Edge]);
1313 Zcoord_Airfoil.push_back(Zcoord_Index0[Next_Edge]);
1314 Variable_Airfoil.push_back(Variable_Index0[Next_Edge]);
1315 IGlobalID_Airfoil.push_back(IGlobalID_Index0[Next_Edge]);
1316 JGlobalID_Airfoil.push_back(JGlobalID_Index0[Next_Edge]);
1319 Xcoord_Index0.erase(Xcoord_Index0.begin() + Next_Edge);
1320 Ycoord_Index0.erase(Ycoord_Index0.begin() + Next_Edge);
1321 Zcoord_Index0.erase(Zcoord_Index0.begin() + Next_Edge);
1322 Variable_Index0.erase(Variable_Index0.begin() + Next_Edge);
1323 IGlobalID_Index0.erase(IGlobalID_Index0.begin() + Next_Edge);
1324 JGlobalID_Index0.erase(JGlobalID_Index0.begin() + Next_Edge);
1326 Xcoord_Index1.erase(Xcoord_Index1.begin() + Next_Edge);
1327 Ycoord_Index1.erase(Ycoord_Index1.begin() + Next_Edge);
1328 Zcoord_Index1.erase(Zcoord_Index1.begin() + Next_Edge);
1329 Variable_Index1.erase(Variable_Index1.begin() + Next_Edge);
1330 IGlobalID_Index1.erase(IGlobalID_Index1.begin() + Next_Edge);
1331 JGlobalID_Index1.erase(JGlobalID_Index1.begin() + Next_Edge);
1336 }
while (Xcoord_Index0.size() != 0);
1340 Xcoord_Index0.clear(); Ycoord_Index0.clear(); Zcoord_Index0.clear(); Variable_Index0.clear(); IGlobalID_Index0.clear(); JGlobalID_Index0.clear();
1341 Xcoord_Index1.clear(); Ycoord_Index1.clear(); Zcoord_Index1.clear(); Variable_Index1.clear(); IGlobalID_Index1.clear(); JGlobalID_Index1.clear();
1352 unsigned short iDim;
1353 unsigned long iPoint;
1355 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
1356 for (iDim = 0; iDim <
nDim; iDim++) {
1363 unsigned short iDim;
1364 unsigned long iPoint;
1366 for (iPoint = 0; iPoint <
nPoint; iPoint++){
1367 for (iDim = 0; iDim <
nDim; iDim++){
1375 unsigned short iMesh;
1386 for (iMesh = 1; iMesh <= config->
GetnMGLevels(); iMesh++) {
1391 geometry_container[iMesh]->
SetCoord(geometry_container[iMesh-1]);
1402 unsigned short iMarker;
1403 unsigned long iVertex;
1411 for(iMarker=0; iMarker <
nMarker; iMarker++){
1419 for(iVertex=0; iVertex <
nVertex[iMarker]; iVertex++){
1425 for(iVertex=0; iVertex <
nVertex[iMarker]; iVertex++){
1433 cout <<
"WARNING: Marker " << Marker_Tag <<
" is not customizable. Using default behavior." << endl;
1443 unsigned short iMGfine, iMGlevel, nMGlevel, iMarker;
1446 for (iMGlevel=1; iMGlevel <= nMGlevel; iMGlevel++){
1447 iMGfine = iMGlevel-1;
1466 unsigned short iMarker, iNeigh_Point, iDim, iNode, iNeighbor_Nodes, Neighbor_Node;
1467 unsigned long Neighbor_Point, iVertex, iPoint, jPoint, iElem_Bound, iEdge, nLocalVertex, MaxLocalVertex , *Buffer_Send_nVertex, *Buffer_Receive_nVertex, TotalnPointDomain;
1468 int iProcessor, nProcessor;
1469 vector<unsigned long> Point_NeighborList, Elem_NeighborList, Point_Triangle, Point_Edge, Point_Critical;
1470 vector<unsigned long>::iterator it;
1471 su2double U[3] = {0.0,0.0,0.0}, V[3] = {0.0,0.0,0.0}, W[3] = {0.0,0.0,0.0}, Length_U, Length_V, Length_W, CosValue, Angle_Value, *K, *Angle_Defect, *Area_Vertex, *Angle_Alpha, *Angle_Beta, **NormalMeanK, MeanK, GaussK, MaxPrinK, cot_alpha, cot_beta, delta, X1, X2, X3, Y1, Y2, Y3, radius, *Buffer_Send_Coord, *Buffer_Receive_Coord, *Coord, Dist, MinDist, MaxK, MinK, SigmaK;
1478 for (iPoint = 0; iPoint <
nPoint; iPoint++) K[iPoint] = 0.0;
1483 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
1489 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
1492 if (
node[iPoint]->GetDomain()) {
1497 for (iNeigh_Point = 0; iNeigh_Point <
node[iPoint]->
GetnPoint(); iNeigh_Point++) {
1502 if (
node[Neighbor_Point]->GetPhysicalBoundary()) {
1503 Point_Edge.push_back(Neighbor_Point);
1508 if (Point_Edge.size() == 2) {
1518 radius = sqrt(((X2-X1)*(X2-X1) + (Y2-Y1)*(Y2-Y1))*
1519 ((X2-X3)*(X2-X3) + (Y2-Y3)*(Y2-Y3))*
1520 ((X3-X1)*(X3-X1) + (Y3-Y1)*(Y3-Y1)))/
1521 (2.0*fabs(X1*Y2+X2*Y3+X3*Y1-X1*Y3-X2*Y1-X3*Y2)+
EPS);
1523 K[iPoint] = 1.0/radius;
1541 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
1543 Area_Vertex[iPoint] = 0.0;
1548 Check_Edge =
new bool [
nEdge];
1549 for (iEdge = 0; iEdge <
nEdge; iEdge++) {
1550 Angle_Alpha[iEdge] = 0.0;
1551 Angle_Beta[iEdge] = 0.0;
1552 Check_Edge[iEdge] =
true;
1556 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
1558 for (iDim = 0; iDim <
nDim; iDim++) {
1559 NormalMeanK[iPoint][iDim] = 0.0;
1564 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
1569 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
1572 if (
bound[iMarker][iElem_Bound]->GetVTK_Type() ==
TRIANGLE) {
1575 for (iNode = 0; iNode <
bound[iMarker][iElem_Bound]->
GetnNodes(); iNode++) {
1579 Point_Triangle.clear();
1581 for (iNeighbor_Nodes = 0; iNeighbor_Nodes <
bound[iMarker][iElem_Bound]->
GetnNeighbor_Nodes(iNode); iNeighbor_Nodes++) {
1583 Neighbor_Point =
bound[iMarker][iElem_Bound]->
GetNode(Neighbor_Node);
1584 Point_Triangle.push_back(Neighbor_Point);
1587 iEdge =
FindEdge(Point_Triangle[0], Point_Triangle[1]);
1589 for (iDim = 0; iDim <
nDim; iDim++) {
1594 W[0] = 0.5*(U[1]*V[2]-U[2]*V[1]); W[1] = -0.5*(U[0]*V[2]-U[2]*V[0]); W[2] = 0.5*(U[0]*V[1]-U[1]*V[0]);
1596 Length_U = 0.0; Length_V = 0.0; Length_W = 0.0; CosValue = 0.0;
1597 for (iDim = 0; iDim <
nDim; iDim++) { Length_U += U[iDim]*U[iDim]; Length_V += V[iDim]*V[iDim]; Length_W += W[iDim]*W[iDim]; }
1598 Length_U = sqrt(Length_U); Length_V = sqrt(Length_V); Length_W = sqrt(Length_W);
1599 for (iDim = 0; iDim <
nDim; iDim++) { U[iDim] /= Length_U; V[iDim] /= Length_V; CosValue += U[iDim]*V[iDim]; }
1600 if (CosValue >= 1.0) CosValue = 1.0;
1601 if (CosValue <= -1.0) CosValue = -1.0;
1603 Angle_Value = acos(CosValue);
1604 Area_Vertex[iPoint] += Length_W;
1605 Angle_Defect[iPoint] -= Angle_Value;
1606 if (Angle_Alpha[iEdge] == 0.0) Angle_Alpha[iEdge] = Angle_Value;
1607 else Angle_Beta[iEdge] = Angle_Value;
1616 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
1618 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
1619 if (
bound[iMarker][iElem_Bound]->GetVTK_Type() ==
TRIANGLE) {
1620 for (iNode = 0; iNode <
bound[iMarker][iElem_Bound]->
GetnNodes(); iNode++) {
1623 for (iNeighbor_Nodes = 0; iNeighbor_Nodes <
bound[iMarker][iElem_Bound]->
GetnNeighbor_Nodes(iNode); iNeighbor_Nodes++) {
1625 jPoint =
bound[iMarker][iElem_Bound]->
GetNode(Neighbor_Node);
1629 if (Check_Edge[iEdge]) {
1631 Check_Edge[iEdge] =
false;
1633 if (tan(Angle_Alpha[iEdge]) != 0.0) cot_alpha = 1.0/tan(Angle_Alpha[iEdge]);
else cot_alpha = 0.0;
1634 if (tan(Angle_Beta[iEdge]) != 0.0) cot_beta = 1.0/tan(Angle_Beta[iEdge]);
else cot_beta = 0.0;
1637 for (iDim = 0; iDim <
nDim; iDim++) {
1638 if (Area_Vertex[iPoint] != 0.0) NormalMeanK[iPoint][iDim] += 3.0 * (cot_alpha + cot_beta) * (
node[iPoint]->GetCoord(iDim) -
node[jPoint]->
GetCoord(iDim)) / Area_Vertex[iPoint];
1639 if (Area_Vertex[jPoint] != 0.0) NormalMeanK[jPoint][iDim] += 3.0 * (cot_alpha + cot_beta) * (
node[jPoint]->GetCoord(iDim) -
node[iPoint]->
GetCoord(iDim)) / Area_Vertex[jPoint];
1653 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
1655 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
1658 if (
node[iPoint]->GetDomain()) {
1660 if (Area_Vertex[iPoint] != 0.0) GaussK = 3.0*Angle_Defect[iPoint]/Area_Vertex[iPoint];
1664 for (iDim = 0; iDim <
nDim; iDim++)
1665 MeanK += NormalMeanK[iPoint][iDim]*NormalMeanK[iPoint][iDim];
1666 MeanK = sqrt(MeanK);
1668 delta = max((MeanK*MeanK - GaussK), 0.0);
1670 MaxPrinK = MeanK + sqrt(delta);
1673 K[iPoint] = MaxPrinK;
1681 delete [] Angle_Defect;
1682 delete [] Area_Vertex;
1683 delete [] Angle_Alpha;
1684 delete [] Angle_Beta;
1685 delete [] Check_Edge;
1687 for (iPoint = 0; iPoint <
nPoint; iPoint++)
1688 delete [] NormalMeanK[iPoint];
1689 delete [] NormalMeanK;
1696 MaxK = K[0]; MinK = K[0]; MeanK = 0.0; TotalnPointDomain = 0;
1697 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
1699 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
1701 if (
node[iPoint]->GetDomain()) {
1702 MaxK = max(MaxK, fabs(K[iPoint]));
1703 MinK = min(MinK, fabs(K[iPoint]));
1704 MeanK += fabs(K[iPoint]);
1705 TotalnPointDomain++;
1714 unsigned long MynPointDomain = TotalnPointDomain; TotalnPointDomain = 0;
1725 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
1727 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
1729 if (
node[iPoint]->GetDomain()) {
1730 SigmaK += (fabs(K[iPoint]) - MeanK) * (fabs(K[iPoint]) - MeanK);
1737 su2double MySigmaK = SigmaK; SigmaK = 0.0;
1741 SigmaK = sqrt(SigmaK/
su2double(TotalnPointDomain));
1744 cout <<
"Max K: " << MaxK <<
". Mean K: " << MeanK <<
". Standard deviation K: " << SigmaK <<
"." << endl;
1746 Point_Critical.clear();
1748 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
1750 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
1752 if (
node[iPoint]->GetDomain()) {
1754 Point_Critical.push_back(iPoint);
1769 Buffer_Send_nVertex =
new unsigned long [1];
1770 Buffer_Receive_nVertex =
new unsigned long [nProcessor];
1774 nLocalVertex = Point_Critical.size();
1775 Buffer_Send_nVertex[0] = nLocalVertex;
1784 MaxLocalVertex = nLocalVertex;
1785 Buffer_Receive_nVertex[0] = nLocalVertex;
1793 Buffer_Receive_Coord =
new su2double [nProcessor*MaxLocalVertex*
nDim];
1796 unsigned long nBuffer = MaxLocalVertex*
nDim;
1799 for (iVertex = 0; iVertex < MaxLocalVertex; iVertex++) {
1800 for (iDim = 0; iDim <
nDim; iDim++) {
1801 Buffer_Send_Coord[iVertex*
nDim+iDim] = 0.0;
1808 for (iVertex = 0; iVertex < Point_Critical.size(); iVertex++) {
1809 iPoint = Point_Critical[iVertex];
1810 for (iDim = 0; iDim <
nDim; iDim++)
1811 Buffer_Send_Coord[iVertex*
nDim+iDim] =
node[iPoint]->GetCoord(iDim);
1817 for (iVertex = 0; iVertex < Point_Critical.size(); iVertex++) {
1818 for (iDim = 0; iDim <
nDim; iDim++) {
1819 Buffer_Receive_Coord[iVertex*
nDim+iDim] = Buffer_Send_Coord[iVertex*
nDim+iDim];
1828 for (iPoint = 0; iPoint <
GetnPoint(); iPoint++) {
1832 for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) {
1833 for (iVertex = 0; iVertex < Buffer_Receive_nVertex[iProcessor]; iVertex++) {
1835 for (iDim = 0; iDim <
nDim; iDim++) {
1836 Dist += (Coord[iDim]-Buffer_Receive_Coord[(iProcessor*MaxLocalVertex+iVertex)*
nDim+iDim])*
1837 (Coord[iDim]-Buffer_Receive_Coord[(iProcessor*MaxLocalVertex+iVertex)*
nDim+iDim]);
1839 if (Dist!=0.0) Dist = sqrt(Dist);
1841 if (Dist < MinDist) MinDist = Dist;
1851 delete[] Buffer_Send_Coord;
1852 delete[] Buffer_Receive_Coord;
1853 delete[] Buffer_Send_nVertex;
1854 delete[] Buffer_Receive_nVertex;
1863 Local_to_Global_Point = NULL;
1864 Local_to_Global_Marker = NULL;
1865 Global_to_Local_Marker = NULL;
1904 Local_to_Global_Point = NULL;
1905 Local_to_Global_Marker = NULL;
1906 Global_to_Local_Marker = NULL;
1938 string text_line, Marker_Tag;
1940 unsigned short iDim, iMarker, iNodes;
1941 unsigned long iPoint, iElem_Bound;
1944 ofstream boundary_file;
1963 cout << endl <<
"---------------------- Read Grid File Information -----------------------" << endl;
1966 switch (val_format) {
1982 switch (val_format) {
1997 assert((
nDim == 2) || (
nDim == 3));
2008 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
2009 for (iDim = 0; iDim <
nDim; iDim++) {
2024 string str =
"boundary.dat";
2030 boundary_file.open(str.c_str(), ios::out);
2034 boundary_file <<
"NMARK= " <<
nMarker << endl;
2036 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
2039 boundary_file <<
"MARKER_TAG= " << Grid_Marker << endl;
2040 boundary_file <<
"MARKER_ELEMS= " <<
nElem_Bound[iMarker]<< endl;
2043 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
2045 for (iNodes = 0; iNodes <
bound[iMarker][iElem_Bound]->
GetnNodes(); iNodes++)
2046 boundary_file <<
bound[iMarker][iElem_Bound]->GetNode(iNodes) <<
"\t" ;
2048 if (
bound[iMarker][iElem_Bound]->GetVTK_Type() ==
VERTEX) {
2051 boundary_file << iElem_Bound << endl;
2056 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
2058 for (iNodes = 0; iNodes <
bound[iMarker][iElem_Bound]->
GetnNodes(); iNodes++)
2059 boundary_file <<
bound[iMarker][iElem_Bound]->GetNode(iNodes) <<
"\t" ;
2061 if (
bound[iMarker][iElem_Bound]->GetVTK_Type() ==
VERTEX) {
2064 boundary_file << iElem_Bound << endl;
2070 boundary_file.close();
2080 Local_to_Global_Point = NULL;
2081 Local_to_Global_Marker = NULL;
2082 Global_to_Local_Marker = NULL;
2116 unsigned long iter, iPoint, jPoint, iElem, iVertex;
2117 unsigned long iElemTotal, iPointTotal, iPointGhost, iPointDomain, iPointPeriodic, iElemTriangle, iElemQuadrilateral, iElemTetrahedron, iElemHexahedron, iElemPrism, iElemPyramid, iPointCurrent;
2118 unsigned long nBoundLineTotal = 0, iBoundLineTotal;
2119 unsigned long nBoundTriangleTotal = 0, iBoundTriangleTotal;
2120 unsigned long nBoundQuadrilateralTotal = 0, iBoundQuadrilateralTotal;
2121 unsigned long ReceptorColor = 0, DonorColor = 0, Transformation;
2122 unsigned long nTotalSendDomain_Periodic = 0, iTotalSendDomain_Periodic, nTotalReceivedDomain_Periodic = 0, iTotalReceivedDomain_Periodic, *nSendDomain_Periodic = NULL, *nReceivedDomain_Periodic = NULL;
2123 unsigned long Buffer_Send_nPointTotal = 0, Buffer_Send_nPointDomainTotal = 0, Buffer_Send_nPointGhost = 0, Buffer_Send_nPointPeriodic = 0;
2124 unsigned long Buffer_Send_nElemTotal, Buffer_Send_nElemTriangle = 0, Buffer_Send_nElemQuadrilateral = 0, Buffer_Send_nElemTetrahedron = 0, Buffer_Send_nElemHexahedron = 0, Buffer_Send_nElemPrism = 0, Buffer_Send_nElemPyramid = 0;
2125 unsigned long Buffer_Send_nTotalSendDomain_Periodic = 0, Buffer_Send_nTotalReceivedDomain_Periodic = 0, *Buffer_Send_nSendDomain_Periodic = NULL, *Buffer_Send_nReceivedDomain_Periodic = NULL;
2126 unsigned long Buffer_Send_nBoundLineTotal = 0, Buffer_Send_nBoundTriangleTotal = 0, Buffer_Send_nBoundQuadrilateralTotal = 0;
2127 unsigned long iVertexDomain, iBoundLine, iBoundTriangle, iBoundQuadrilateral;
2129 unsigned long iNode, iDim, iMarker, jMarker, nMarkerDomain = 0, iMarkerDomain;
2130 unsigned long nDomain = 0, iDomain, jDomain, nPeriodic = 0, iPeriodic, Buffer_Send_nMarkerDomain = 0, Buffer_Send_nDim = 0, Buffer_Send_nZone = 0, Buffer_Send_nPeriodic = 0;
2132 bool *MarkerIn = NULL, **VertexIn = NULL, *ElemIn = NULL;
2133 long vnodes_local[8];
2135 vector<long> DomainList;
2136 short *Marker_All_SendRecv_Copy = NULL;
2137 string *Marker_All_TagBound_Copy = NULL;
2146 unsigned long *nVertexDomain =
new unsigned long[nMarker_Max];
2147 unsigned long *nBoundLine =
new unsigned long[nMarker_Max];
2148 unsigned long *nBoundTriangle =
new unsigned long[nMarker_Max];
2149 unsigned long *nBoundQuadrilateral =
new unsigned long[nMarker_Max];
2151 unsigned long *Buffer_Send_nVertexDomain =
new unsigned long[nMarker_Max];
2152 unsigned long *Buffer_Send_nBoundLine =
new unsigned long[nMarker_Max];
2153 unsigned long *Buffer_Send_nBoundTriangle =
new unsigned long[nMarker_Max];
2154 unsigned long *Buffer_Send_nBoundQuadrilateral =
new unsigned long[nMarker_Max];
2156 short *Buffer_Send_Marker_All_SendRecv =
new short[nMarker_Max];
2159 char *Buffer_Send_Marker_All_TagBound =
new char[nMarker_Max*
MAX_STRING_SIZE];
2166 unsigned long source;
2179 cout <<
"Communicating partition data and creating halo layers." << endl;
2185 unsigned long *Buffer_Send_Color = NULL;
2186 unsigned long *Buffer_Send_GlobalPointIndex = NULL;
2187 unsigned long *Buffer_Send_Triangle = NULL;
2188 unsigned long *Buffer_Send_Quadrilateral = NULL;
2189 unsigned long *Buffer_Send_Tetrahedron = NULL;
2190 unsigned long *Buffer_Send_Hexahedron = NULL;
2191 unsigned long *Buffer_Send_Prism = NULL;
2192 unsigned long *Buffer_Send_Pyramid = NULL;
2193 unsigned long *Buffer_Send_GlobElem = NULL;
2197 unsigned long *Buffer_Send_BoundLine = NULL, *Buffer_Receive_BoundLine = NULL;
2198 unsigned long *Buffer_Send_BoundTriangle = NULL, *Buffer_Receive_BoundTriangle = NULL;
2199 unsigned long *Buffer_Send_BoundQuadrilateral = NULL, *Buffer_Receive_BoundQuadrilateral = NULL;
2200 unsigned long *Buffer_Send_Local2Global_Marker = NULL, *Buffer_Receive_Local2Global_Marker = NULL;
2204 su2double *Buffer_Send_Center = NULL, *Buffer_Receive_Center = NULL;
2205 su2double *Buffer_Send_Rotation = NULL, *Buffer_Receive_Rotation = NULL;
2206 su2double *Buffer_Send_Translate = NULL, *Buffer_Receive_Translate = NULL;
2210 unsigned long *Buffer_Send_SendDomain_Periodic = NULL, *Buffer_Receive_SendDomain_Periodic = NULL;
2211 unsigned long *Buffer_Send_SendDomain_PeriodicTrans = NULL, *Buffer_Receive_SendDomain_PeriodicTrans = NULL;
2212 unsigned long *Buffer_Send_SendDomain_PeriodicReceptor = NULL, *Buffer_Receive_SendDomain_PeriodicReceptor = NULL;
2213 unsigned long *Buffer_Send_ReceivedDomain_Periodic = NULL, *Buffer_Receive_ReceivedDomain_Periodic = NULL;
2214 unsigned long *Buffer_Send_ReceivedDomain_PeriodicTrans = NULL, *Buffer_Receive_ReceivedDomain_PeriodicTrans = NULL;
2215 unsigned long *Buffer_Send_ReceivedDomain_PeriodicDonor = NULL, *Buffer_Receive_ReceivedDomain_PeriodicDonor = NULL;
2219 unsigned short *nDim_s =
new unsigned short[
size];
2220 unsigned short *nDim_r =
new unsigned short[
size];
2221 unsigned short *nZone_s =
new unsigned short[
size];
2222 unsigned short *nZone_r =
new unsigned short[
size];
2224 unsigned long *nPointTotal_s =
new unsigned long[
size];
2225 unsigned long *nPointDomainTotal_s =
new unsigned long[
size];
2226 unsigned long *nPointGhost_s =
new unsigned long[
size];
2227 unsigned long *nPointPeriodic_s =
new unsigned long[
size];
2228 unsigned long *nElemTotal_s =
new unsigned long[
size];
2229 unsigned long *nElemTriangle_s =
new unsigned long[
size];
2230 unsigned long *nElemQuadrilateral_s =
new unsigned long[
size];
2231 unsigned long *nElemTetrahedron_s =
new unsigned long[
size];
2232 unsigned long *nElemHexahedron_s =
new unsigned long[
size];
2233 unsigned long *nElemPrism_s =
new unsigned long[
size];
2234 unsigned long *nElemPyramid_s =
new unsigned long[
size];
2236 unsigned long *nPointTotal_r =
new unsigned long[
size];
2237 unsigned long *nPointDomainTotal_r =
new unsigned long[
size];
2238 unsigned long *nPointGhost_r =
new unsigned long[
size];
2239 unsigned long *nPointPeriodic_r =
new unsigned long[
size];
2240 unsigned long *nElemTotal_r =
new unsigned long[
size];
2241 unsigned long *nElemTriangle_r =
new unsigned long[
size];
2242 unsigned long *nElemQuadrilateral_r =
new unsigned long[
size];
2243 unsigned long *nElemTetrahedron_r =
new unsigned long[
size];
2244 unsigned long *nElemHexahedron_r =
new unsigned long[
size];
2245 unsigned long *nElemPrism_r =
new unsigned long[
size];
2246 unsigned long *nElemPyramid_r =
new unsigned long[
size];
2250 unsigned long nPointTotal_r_tot=0;
2251 unsigned long nPointDomainTotal_r_tot=0;
2252 unsigned long nPointGhost_r_tot=0;
2253 unsigned long nPointPeriodic_r_tot=0;
2254 unsigned long nElemTotal_r_tot=0;
2255 unsigned long nElemTriangle_r_tot=0;
2256 unsigned long nElemQuadrilateral_r_tot=0;
2257 unsigned long nElemTetrahedron_r_tot=0;
2258 unsigned long nElemHexahedron_r_tot=0;
2259 unsigned long nElemPrism_r_tot=0;
2260 unsigned long nElemPyramid_r_tot=0;
2262 unsigned long Buffer_Size_Coord = 0;
2263 unsigned long Buffer_Size_Color = 0;
2264 unsigned long Buffer_Size_GlobalPointIndex = 0;
2265 unsigned long Buffer_Size_Triangle = 0;
2266 unsigned long Buffer_Size_Quadrilateral = 0;
2267 unsigned long Buffer_Size_Tetrahedron = 0;
2268 unsigned long Buffer_Size_Hexahedron = 0;
2269 unsigned long Buffer_Size_Prism = 0;
2270 unsigned long Buffer_Size_Pyramid = 0;
2271 unsigned long Buffer_Size_GlobElem = 0;
2273 unsigned long ElemTotal_Counter = 0;
2274 unsigned long PointTotal_Counter = 0;
2275 unsigned long PointDomain_Counter = 0;
2278 unsigned long PointPeriodic_Counter = 0;
2279 unsigned long PointGhost_Counter = 0;
2280 unsigned long ElemTriangle_Counter = 0;
2281 unsigned long ElemQuadrilateral_Counter = 0;
2282 unsigned long ElemTetrahedron_Counter = 0;
2283 unsigned long ElemHexahedron_Counter = 0;
2284 unsigned long ElemPrism_Counter = 0;
2285 unsigned long ElemPyramid_Counter = 0;
2287 unsigned long *Local_to_global_Triangle = NULL;
2288 unsigned long *Local_to_global_Quadrilateral = NULL;
2289 unsigned long *Local_to_global_Tetrahedron = NULL;
2290 unsigned long *Local_to_global_Hexahedron = NULL;
2291 unsigned long *Local_to_global_Prism = NULL;
2292 unsigned long *Local_to_global_Pyramid = NULL;
2294 map<unsigned long,bool> Triangle_presence;
2295 map<unsigned long,bool> Quadrilateral_presence;
2296 map<unsigned long,bool> Tetrahedron_presence;
2297 map<unsigned long,bool> Hexahedron_presence;
2298 map<unsigned long,bool> Prism_presence;
2299 map<unsigned long,bool> Pyramid_presence;
2301 su2double *Buffer_Receive_Coord_loc = NULL;
2303 unsigned long *Buffer_Receive_Color_loc = NULL;
2304 unsigned long *Buffer_Receive_GlobalPointIndex_loc = NULL;
2305 unsigned long *Buffer_Receive_Triangle_loc = NULL;
2306 unsigned long *Buffer_Receive_Quadrilateral_loc = NULL;
2307 unsigned long *Buffer_Receive_Tetrahedron_loc = NULL;
2308 unsigned long *Buffer_Receive_Hexahedron_loc = NULL;
2309 unsigned long *Buffer_Receive_Prism_loc = NULL;
2310 unsigned long *Buffer_Receive_Pyramid_loc = NULL;
2312 unsigned long *Buffer_Receive_GlobElem_loc = NULL;
2313 unsigned long *Buffer_Receive_Triangle_presence_loc = NULL;
2314 unsigned long *Buffer_Receive_Quadrilateral_presence_loc = NULL;
2315 unsigned long *Buffer_Receive_Tetrahedron_presence_loc = NULL;
2316 unsigned long *Buffer_Receive_Hexahedron_presence_loc = NULL;
2317 unsigned long *Buffer_Receive_Prism_presence_loc = NULL;
2318 unsigned long *Buffer_Receive_Pyramid_presence_loc = NULL;
2326 unsigned long *Buffer_Receive_Color = NULL;
2327 unsigned long *Buffer_Receive_GlobalPointIndex = NULL;
2328 unsigned long *Buffer_Receive_Triangle = NULL;
2329 unsigned long *Buffer_Receive_Quadrilateral = NULL;
2330 unsigned long *Buffer_Receive_Tetrahedron = NULL;
2331 unsigned long *Buffer_Receive_Hexahedron = NULL;
2332 unsigned long *Buffer_Receive_Prism = NULL;
2333 unsigned long *Buffer_Receive_Pyramid = NULL;
2334 unsigned long *Buffer_Receive_GlobElem = NULL;
2336 unsigned long **Buffer_Receive_Triangle_presence =
new unsigned long*[
size];
2337 unsigned long **Buffer_Receive_Quadrilateral_presence =
new unsigned long*[
size];
2338 unsigned long **Buffer_Receive_Tetrahedron_presence =
new unsigned long*[
size];
2339 unsigned long **Buffer_Receive_Hexahedron_presence =
new unsigned long*[
size];
2340 unsigned long **Buffer_Receive_Prism_presence =
new unsigned long*[
size];
2341 unsigned long **Buffer_Receive_Pyramid_presence =
new unsigned long*[
size];
2350 nSendDomain_Periodic =
new unsigned long [nDomain];
2351 nReceivedDomain_Periodic =
new unsigned long [nDomain];
2355 ElemIn =
new bool[geometry->
GetnElem()];
2358 map<unsigned long,bool> PointIn;
2359 map<unsigned long,unsigned long> Global_to_local_Point_recv;
2361 Buffer_Send_nDim = geometry->
GetnDim();
2362 Buffer_Send_nZone = geometry->
GetnZone();
2366 map<unsigned long,unsigned long> Local_to_global_elem;
2376 unsigned long *local_colour_values =
new unsigned long[geometry->
GetGlobal_nPoint()];
2391 for (iDomain=0; iDomain < (
unsigned long)
size; iDomain++) {
2392 if (iDomain != (
unsigned long)
rank) {
2399 for (iDomain=0; iDomain < (
unsigned long)
size-1; iDomain++) {
2416 delete [] local_colour_temp;
2425 for (iDomain = 0; iDomain < nDomain; iDomain++) {
2430 Buffer_Send_nElemTotal = 0;
2431 Buffer_Send_nPointTotal = 0;
2432 Buffer_Send_nPointGhost = 0;
2433 Buffer_Send_nPointDomainTotal = 0;
2434 Buffer_Send_nPointPeriodic = 0;
2435 Buffer_Send_nElemTriangle = 0;
2436 Buffer_Send_nElemQuadrilateral = 0;
2437 Buffer_Send_nElemTetrahedron = 0;
2438 Buffer_Send_nElemHexahedron = 0;
2439 Buffer_Send_nElemPrism = 0;
2440 Buffer_Send_nElemPyramid = 0;
2449 for (iElem = 0; iElem < geometry->
GetnElem(); iElem++) {
2453 ElemIn[iElem] =
false;
2454 for (iNode = 0; iNode < geometry->
elem[iElem]->
GetnNodes(); iNode++) {
2456 if (local_colour_values[iPoint] == iDomain) {
2457 ElemIn[iElem] =
true;
break;
2464 if (ElemIn[iElem]) {
2466 for (iNode = 0; iNode < geometry->
elem[iElem]->
GetnNodes(); iNode++) {
2471 map<unsigned long, bool>::const_iterator MI = PointIn.find(iPoint);
2472 if (MI == PointIn.end()) {
2476 PointIn[iPoint] =
true;
2481 Buffer_Send_nPointTotal++;
2484 if ( local_colour_values[iPoint] == iDomain ) {
2486 Buffer_Send_nPointPeriodic++;
2488 Buffer_Send_nPointDomainTotal++;
2490 else Buffer_Send_nPointGhost++;
2500 case TRIANGLE: Buffer_Send_nElemTriangle++;
break;
2501 case QUADRILATERAL: Buffer_Send_nElemQuadrilateral++;
break;
2502 case TETRAHEDRON: Buffer_Send_nElemTetrahedron++;
break;
2503 case HEXAHEDRON: Buffer_Send_nElemHexahedron++;
break;
2504 case PRISM: Buffer_Send_nElemPrism++;
break;
2505 case PYRAMID: Buffer_Send_nElemPyramid++;
break;
2510 Buffer_Send_nElemTotal++;
2517 nDim_s[iDomain] = geometry->
GetnDim();
2518 nZone_s[iDomain] = Buffer_Send_nZone;
2519 nPointTotal_s[iDomain] = Buffer_Send_nPointTotal;
2520 nPointDomainTotal_s[iDomain] = Buffer_Send_nPointDomainTotal;
2521 nPointGhost_s[iDomain] = Buffer_Send_nPointGhost;
2522 nPointPeriodic_s[iDomain] = Buffer_Send_nPointPeriodic;
2523 nElemTotal_s[iDomain] = Buffer_Send_nElemTotal;
2524 nElemTriangle_s[iDomain] = Buffer_Send_nElemTriangle;
2525 nElemQuadrilateral_s[iDomain] = Buffer_Send_nElemQuadrilateral;
2526 nElemTetrahedron_s[iDomain] = Buffer_Send_nElemTetrahedron;
2527 nElemHexahedron_s[iDomain] = Buffer_Send_nElemHexahedron;
2528 nElemPrism_s[iDomain] = Buffer_Send_nElemPrism;
2529 nElemPyramid_s[iDomain] = Buffer_Send_nElemPyramid;
2533 Buffer_Size_Coord += nPointTotal_s[iDomain]*nDim_s[iDomain];
2534 Buffer_Size_Color += nPointTotal_s[iDomain];
2535 Buffer_Size_GlobalPointIndex += nPointTotal_s[iDomain];
2536 Buffer_Size_Triangle += nElemTriangle_s[iDomain];
2537 Buffer_Size_Quadrilateral += nElemQuadrilateral_s[iDomain];
2538 Buffer_Size_Tetrahedron += nElemTetrahedron_s[iDomain];
2539 Buffer_Size_Hexahedron += nElemHexahedron_s[iDomain];
2540 Buffer_Size_Prism += nElemPrism_s[iDomain];
2541 Buffer_Size_Pyramid += nElemPyramid_s[iDomain];
2542 Buffer_Size_GlobElem += nElemTotal_s[iDomain];
2548 Buffer_Send_Coord =
new su2double[Buffer_Size_Coord];
2550 Buffer_Send_Color =
new unsigned long[Buffer_Size_Color];
2551 Buffer_Send_GlobalPointIndex =
new unsigned long[Buffer_Size_GlobalPointIndex];
2552 Buffer_Send_Triangle =
new unsigned long[Buffer_Size_Triangle*
N_POINTS_TRIANGLE];
2556 Buffer_Send_Prism =
new unsigned long[Buffer_Size_Prism*
N_POINTS_PRISM];
2557 Buffer_Send_Pyramid =
new unsigned long[Buffer_Size_Pyramid*
N_POINTS_PYRAMID];
2558 Buffer_Send_GlobElem =
new unsigned long[Buffer_Size_GlobElem];
2560 Local_to_global_Triangle =
new unsigned long[Buffer_Size_Triangle];
2561 Local_to_global_Quadrilateral =
new unsigned long[Buffer_Size_Quadrilateral];
2562 Local_to_global_Tetrahedron =
new unsigned long[Buffer_Size_Tetrahedron];
2563 Local_to_global_Hexahedron =
new unsigned long[Buffer_Size_Hexahedron];
2564 Local_to_global_Prism =
new unsigned long[Buffer_Size_Prism];
2565 Local_to_global_Pyramid =
new unsigned long[Buffer_Size_Pyramid];
2569 ElemTotal_Counter = 0;
2570 PointTotal_Counter = 0;
2571 PointDomain_Counter = 0;
2573 PointPeriodic_Counter = 0;
2574 PointGhost_Counter = 0;
2575 ElemTriangle_Counter = 0;
2576 ElemQuadrilateral_Counter = 0;
2577 ElemTetrahedron_Counter = 0;
2578 ElemHexahedron_Counter = 0;
2579 ElemPrism_Counter = 0;
2580 ElemPyramid_Counter = 0;
2585 for (iDomain = 0; iDomain < nDomain; iDomain++) {
2589 if ((
unsigned long)
rank != iDomain) {
2640 nDim = nDim_s[iDomain];
2641 nZone = nZone_s[iDomain];
2655 nDim_r[iDomain] = nDim_s[iDomain];
2656 nZone_r[iDomain] = nZone_s[iDomain];
2657 nPointTotal_r[iDomain] = nPointTotal_s[iDomain];
2658 nPointDomainTotal_r[iDomain] = nPointDomainTotal_s[iDomain];
2659 nPointPeriodic_r[iDomain] = nPointPeriodic_s[iDomain];
2660 nElemTotal_r[iDomain] = nElemTotal_s[iDomain];
2661 nElemTriangle_r[iDomain] = nElemTriangle_s[iDomain];
2662 nElemQuadrilateral_r[iDomain] = nElemQuadrilateral_s[iDomain];
2663 nElemTetrahedron_r[iDomain] = nElemTetrahedron_s[iDomain];
2664 nElemHexahedron_r[iDomain] = nElemHexahedron_s[iDomain];
2665 nElemPrism_r[iDomain] = nElemPrism_s[iDomain];
2666 nElemPyramid_r[iDomain] = nElemPyramid_s[iDomain];
2668 nPointTotal_r_tot += nPointTotal_r[iDomain];
2669 nPointDomainTotal_r_tot += nPointDomainTotal_r[iDomain];
2670 nPointGhost_r_tot += nPointGhost_r[iDomain];
2671 nPointPeriodic_r_tot += nPointPeriodic_r[iDomain];
2672 nElemTotal_r_tot += nElemTotal_r[iDomain];
2673 nElemTriangle_r_tot += nElemTriangle_r[iDomain];
2674 nElemQuadrilateral_r_tot += nElemQuadrilateral_r[iDomain];
2675 nElemTetrahedron_r_tot += nElemTetrahedron_r[iDomain];
2676 nElemHexahedron_r_tot += nElemHexahedron_r[iDomain];
2677 nElemPrism_r_tot += nElemPrism_r[iDomain];
2678 nElemPyramid_r_tot += nElemPyramid_r[iDomain];
2686 if ((
unsigned long)
rank == iDomain) {
2688 for (jDomain = 0; jDomain < (
unsigned long)
size; jDomain++) {
2692 if ((
unsigned long)
rank != jDomain) {
2741 nPointTotal_r_tot += nPointTotal_r[jDomain];
2742 nPointDomainTotal_r_tot += nPointDomainTotal_r[jDomain];
2743 nPointGhost_r_tot += nPointGhost_r[jDomain];
2744 nPointPeriodic_r_tot += nPointPeriodic_r[jDomain];
2745 nElemTotal_r_tot += nElemTotal_r[jDomain];
2746 nElemTriangle_r_tot += nElemTriangle_r[jDomain];
2747 nElemQuadrilateral_r_tot += nElemQuadrilateral_r[jDomain];
2748 nElemTetrahedron_r_tot += nElemTetrahedron_r[jDomain];
2749 nElemHexahedron_r_tot += nElemHexahedron_r[jDomain];
2750 nElemPrism_r_tot += nElemPrism_r[jDomain];
2751 nElemPyramid_r_tot += nElemPyramid_r[jDomain];
2759 for (iDomain = 0; iDomain < nDomain; iDomain++) {
2770 for (iDomain = 0; iDomain < nDomain; iDomain++) {
2781 iPointPeriodic = nPointDomainTotal_s[iDomain];
2782 iPointGhost = nPointDomainTotal_s[iDomain] + nPointPeriodic_s[iDomain];
2784 iElemQuadrilateral = 0;
2785 iElemTetrahedron = 0;
2786 iElemHexahedron = 0;
2796 for (iElem = 0; iElem < geometry->
GetnElem(); iElem++) {
2800 ElemIn[iElem] =
false;
2801 for (iNode = 0; iNode < geometry->
elem[iElem]->
GetnNodes(); iNode++) {
2803 if (local_colour_values[iPoint] == iDomain) {
2804 ElemIn[iElem] =
true;
break;
2810 if (ElemIn[iElem]) {
2815 Buffer_Send_GlobElem[ElemTotal_Counter+iElemTotal] = Local_to_global_elem[iElem];
2819 for (iNode = 0; iNode < geometry->
elem[iElem]->
GetnNodes(); iNode++) {
2825 vnodes_local[iNode] = iPoint;
2829 map<unsigned long, bool>::const_iterator MI = PointIn.find(iPoint);
2830 if (MI == PointIn.end()) {
2841 if (local_colour_values[iPoint] == iDomain) {
2847 iPointCurrent = iPointPeriodic;
2849 iPointCurrent = iPointDomain;
2854 iPointCurrent = iPointGhost;
2860 PointIn[iPoint] =
true;
2862 Buffer_Send_Color[PointTotal_Counter+iPointCurrent] = local_colour_values[iPoint];
2863 Buffer_Send_GlobalPointIndex[PointTotal_Counter+iPointCurrent] = iPoint;
2867 for (iDim = 0; iDim < nDim_s[iDomain]; iDim++) {
2872 Buffer_Send_Coord[nDim_s[iDomain]*(PointTotal_Counter+iPointCurrent)+iDim] = geometry->
node[iPoint-geometry->
starting_node[
rank]]->
GetCoord(iDim);
2876 if ( local_colour_values[iPoint] == iDomain ) {
2898 for (iNode = 0; iNode < geometry->
elem[iElem]->
GetnNodes(); iNode++)
2899 Buffer_Send_Triangle[3*(ElemTriangle_Counter+iElemTriangle)+iNode] = vnodes_local[iNode];
2900 Local_to_global_Triangle[ElemTriangle_Counter+iElemTriangle] = Buffer_Send_GlobElem[ElemTotal_Counter+iElemTotal];
2901 iElemTriangle++;
break;
2903 for (iNode = 0; iNode < geometry->
elem[iElem]->
GetnNodes(); iNode++)
2904 Buffer_Send_Quadrilateral[4*(ElemQuadrilateral_Counter+iElemQuadrilateral)+iNode] = vnodes_local[iNode];
2905 Local_to_global_Quadrilateral[ElemQuadrilateral_Counter+iElemQuadrilateral] =Buffer_Send_GlobElem[ElemTotal_Counter+iElemTotal];
2906 iElemQuadrilateral++;
break;
2908 for (iNode = 0; iNode < geometry->
elem[iElem]->
GetnNodes(); iNode++)
2909 Buffer_Send_Tetrahedron[4*(ElemTetrahedron_Counter+iElemTetrahedron)+iNode] = vnodes_local[iNode];
2910 Local_to_global_Tetrahedron[ElemTetrahedron_Counter+iElemTetrahedron] =Buffer_Send_GlobElem[ElemTotal_Counter+iElemTotal];
2911 iElemTetrahedron++;
break;
2913 for (iNode = 0; iNode < geometry->
elem[iElem]->
GetnNodes(); iNode++)
2914 Buffer_Send_Hexahedron[8*(ElemHexahedron_Counter+iElemHexahedron)+iNode] = vnodes_local[iNode];
2915 Local_to_global_Hexahedron[ElemHexahedron_Counter+iElemHexahedron] =Buffer_Send_GlobElem[ElemTotal_Counter+iElemTotal];
2916 iElemHexahedron++;
break;
2918 for (iNode = 0; iNode < geometry->
elem[iElem]->
GetnNodes(); iNode++)
2919 Buffer_Send_Prism[6*(ElemPrism_Counter+iElemPrism)+iNode] = vnodes_local[iNode];
2920 Local_to_global_Prism[ElemPrism_Counter+iElemPrism] =Buffer_Send_GlobElem[ElemTotal_Counter+iElemTotal];
2921 iElemPrism++;
break;
2923 for (iNode = 0; iNode < geometry->
elem[iElem]->
GetnNodes(); iNode++)
2924 Buffer_Send_Pyramid[5*(ElemPyramid_Counter+iElemPyramid)+iNode] = vnodes_local[iNode];
2925 Local_to_global_Pyramid[ElemPyramid_Counter+iElemPyramid] = Buffer_Send_GlobElem[ElemTotal_Counter+iElemTotal];
2926 iElemPyramid++;
break;
2937 if (iDomain != (
unsigned long)
rank) {
2944 SU2_MPI::Isend(&Buffer_Send_Coord[PointTotal_Counter*nDim_s[iDomain]],
2945 nPointTotal_s[iDomain]*nDim_s[iDomain],
MPI_DOUBLE, iDomain,
2948 SU2_MPI::Isend(&Buffer_Send_GlobalPointIndex[PointTotal_Counter],
2960 SU2_MPI::Isend(&Buffer_Send_Quadrilateral[ElemQuadrilateral_Counter*4],
2964 SU2_MPI::Isend(&Buffer_Send_Tetrahedron[ElemTetrahedron_Counter*4],
2968 SU2_MPI::Isend(&Buffer_Send_Hexahedron[ElemHexahedron_Counter*8],
2988 SU2_MPI::Isend(&Local_to_global_Quadrilateral[ElemQuadrilateral_Counter],
2992 SU2_MPI::Isend(&Local_to_global_Tetrahedron[ElemTetrahedron_Counter],
2996 SU2_MPI::Isend(&Local_to_global_Hexahedron[ElemHexahedron_Counter],
3014 Buffer_Receive_Coord_loc =
new su2double[nPointTotal_s[iDomain]*nDim_s[iDomain]];
3016 Buffer_Receive_GlobalPointIndex_loc =
new unsigned long[nPointTotal_s[iDomain]];
3017 Buffer_Receive_Color_loc =
new unsigned long[nPointTotal_s[iDomain]];
3018 Buffer_Receive_Triangle_loc =
new unsigned long[nElemTriangle_s[iDomain]*
N_POINTS_TRIANGLE];
3019 Buffer_Receive_Quadrilateral_loc =
new unsigned long[nElemQuadrilateral_s[iDomain]*
N_POINTS_QUADRILATERAL];
3020 Buffer_Receive_Tetrahedron_loc =
new unsigned long[nElemTetrahedron_s[iDomain]*
N_POINTS_TETRAHEDRON];
3021 Buffer_Receive_Hexahedron_loc =
new unsigned long[nElemHexahedron_s[iDomain]*
N_POINTS_HEXAHEDRON];
3022 Buffer_Receive_Prism_loc =
new unsigned long[nElemPrism_s[iDomain]*
N_POINTS_PRISM];
3023 Buffer_Receive_Pyramid_loc =
new unsigned long[nElemPyramid_s[iDomain]*
N_POINTS_PYRAMID];
3024 Buffer_Receive_GlobElem_loc =
new unsigned long[nElemTotal_s[iDomain]];
3026 Buffer_Receive_Triangle_presence_loc =
new unsigned long[nElemTriangle_s[iDomain]];
3027 Buffer_Receive_Quadrilateral_presence_loc =
new unsigned long[nElemQuadrilateral_s[iDomain]];
3028 Buffer_Receive_Tetrahedron_presence_loc =
new unsigned long[nElemTetrahedron_s[iDomain]];
3029 Buffer_Receive_Hexahedron_presence_loc =
new unsigned long[nElemHexahedron_s[iDomain]];
3030 Buffer_Receive_Prism_presence_loc =
new unsigned long[nElemPrism_s[iDomain]];
3031 Buffer_Receive_Pyramid_presence_loc =
new unsigned long[nElemPyramid_s[iDomain]];
3033 for (iter = 0; iter < nPointTotal_s[iDomain]*nDim_s[iDomain]; iter++)
3034 Buffer_Receive_Coord_loc[iter] = Buffer_Send_Coord[PointTotal_Counter*nDim_s[iDomain]+iter];
3036 for (iter = 0; iter < nPointTotal_s[iDomain]; iter++) {
3037 Buffer_Receive_GlobalPointIndex_loc[iter] = Buffer_Send_GlobalPointIndex[PointTotal_Counter+iter];
3038 Buffer_Receive_Color_loc[iter] = Buffer_Send_Color[PointTotal_Counter+iter];
3042 Buffer_Receive_Triangle_loc[iter] = Buffer_Send_Triangle[ElemTriangle_Counter*
N_POINTS_TRIANGLE+iter];
3045 Buffer_Receive_Quadrilateral_loc[iter] = Buffer_Send_Quadrilateral[ElemQuadrilateral_Counter*
N_POINTS_QUADRILATERAL+iter];
3048 Buffer_Receive_Tetrahedron_loc[iter] = Buffer_Send_Tetrahedron[ElemTetrahedron_Counter*
N_POINTS_TETRAHEDRON+iter];
3051 Buffer_Receive_Hexahedron_loc[iter] = Buffer_Send_Hexahedron[ElemHexahedron_Counter*
N_POINTS_HEXAHEDRON+iter];
3053 for (iter = 0; iter < nElemPrism_s[iDomain]*
N_POINTS_PRISM; iter++)
3054 Buffer_Receive_Prism_loc[iter] = Buffer_Send_Prism[ElemPrism_Counter*
N_POINTS_PRISM+iter];
3057 Buffer_Receive_Pyramid_loc[iter] = Buffer_Send_Pyramid[ElemPyramid_Counter*
N_POINTS_PYRAMID+iter];
3059 for (
unsigned long i=0; i<nElemTotal_s[iDomain]; i++) {
3060 Buffer_Receive_GlobElem_loc[i]=Buffer_Send_GlobElem[ElemTotal_Counter+i];
3063 for (
unsigned long i=0; i<nElemTriangle_s[iDomain]; i++) {
3064 Buffer_Receive_Triangle_presence_loc[i]=Local_to_global_Triangle[ElemTriangle_Counter+i];
3067 for (
unsigned long i=0; i<nElemQuadrilateral_s[iDomain]; i++) {
3068 Buffer_Receive_Quadrilateral_presence_loc[i]=Local_to_global_Quadrilateral[ElemQuadrilateral_Counter+i];
3071 for (
unsigned long i=0; i<nElemTetrahedron_s[iDomain]; i++) {
3072 Buffer_Receive_Tetrahedron_presence_loc[i]=Local_to_global_Tetrahedron[ElemTetrahedron_Counter+i];
3075 for (
unsigned long i=0; i<nElemHexahedron_s[iDomain]; i++) {
3076 Buffer_Receive_Hexahedron_presence_loc[i]=Local_to_global_Hexahedron[ElemHexahedron_Counter+i];
3079 for (
unsigned long i=0; i<nElemPrism_s[iDomain]; i++) {
3080 Buffer_Receive_Prism_presence_loc[i]=Local_to_global_Prism[ElemPrism_Counter+i];
3083 for (
unsigned long i=0; i<nElemPyramid_s[iDomain]; i++) {
3084 Buffer_Receive_Pyramid_presence_loc[i]=Local_to_global_Pyramid[ElemPyramid_Counter+i];
3090 ElemTotal_Counter += iElemTotal;
3091 PointTotal_Counter += iPointTotal;
3092 PointDomain_Counter += iPointDomain;
3094 PointPeriodic_Counter += iPointPeriodic;
3095 PointGhost_Counter += iPointGhost;
3096 ElemTriangle_Counter += iElemTriangle;
3097 ElemQuadrilateral_Counter += iElemQuadrilateral;
3098 ElemTetrahedron_Counter += iElemTetrahedron;
3099 ElemHexahedron_Counter += iElemHexahedron;
3100 ElemPrism_Counter += iElemPrism;
3101 ElemPyramid_Counter += iElemPyramid;
3113 nPoint = nPointTotal_r_tot;
3117 Local_to_Global_Point =
new long[
nPoint];
3121 for (iPoint = 0; iPoint < nPointTotal_r_tot; iPoint++) {
3122 Local_to_Global_Point[iPoint] = -1;
3127 unsigned long temp_node_count = 0;
3128 unsigned long temp_node_count_periodic = nPointDomainTotal_r_tot;
3129 unsigned long temp_node_count_ghost = nPointDomainTotal_r_tot+nPointPeriodic_r_tot;
3134 for (iDomain = 0; iDomain < (
unsigned long)
size; iDomain++) {
3136 if ((
unsigned long)
rank != iDomain) {
3143 Buffer_Receive_Coord =
new su2double [nPointTotal_r[iDomain]*nDim_r[iDomain]];
3144 Buffer_Receive_Color =
new unsigned long [nPointTotal_r[iDomain]];
3145 Buffer_Receive_GlobalPointIndex =
new unsigned long [nPointTotal_r[iDomain]];
3170 unsigned long index=0;
3171 for (iPoint = 0; iPoint < nPointTotal_r[iDomain]; iPoint++) {
3175 if (Buffer_Receive_Color[iPoint] == (
unsigned long)
rank) {
3185 index = temp_node_count_periodic;
3188 Local_to_Global_Point[index] = Buffer_Receive_GlobalPointIndex[iPoint];
3192 Buffer_Receive_Coord[iPoint*
nDim+1],
3193 Local_to_Global_Point[index], config);
3195 Buffer_Receive_Coord[iPoint*
nDim+1],
3196 Buffer_Receive_Coord[iPoint*
nDim+2],
3197 Local_to_Global_Point[index], config);
3203 temp_node_count_periodic++;
3214 index = temp_node_count;
3217 Local_to_Global_Point[index] = Buffer_Receive_GlobalPointIndex[iPoint];
3221 Buffer_Receive_Coord[iPoint*
nDim+1],
3222 Local_to_Global_Point[index], config);
3224 Buffer_Receive_Coord[iPoint*
nDim+1],
3225 Buffer_Receive_Coord[iPoint*
nDim+2],
3226 Local_to_Global_Point[index], config);
3246 index=temp_node_count_ghost;
3249 Local_to_Global_Point[index] = Buffer_Receive_GlobalPointIndex[iPoint];
3253 Buffer_Receive_Coord[iPoint*
nDim+1],
3254 Local_to_Global_Point[index], config);
3256 Buffer_Receive_Coord[iPoint*
nDim+1],
3257 Buffer_Receive_Coord[iPoint*
nDim+2],
3258 Local_to_Global_Point[index], config);
3264 temp_node_count_ghost++;
3270 delete [] Buffer_Receive_Coord;
3271 delete [] Buffer_Receive_Color;
3272 delete [] Buffer_Receive_GlobalPointIndex;
3280 unsigned long index = 0;
3281 for (iPoint = 0; iPoint < nPointTotal_r[iDomain]; iPoint++) {
3283 if (Buffer_Receive_Color_loc[iPoint] == (
unsigned long)
rank) {
3290 index = temp_node_count_periodic;
3292 Local_to_Global_Point[index] = Buffer_Receive_GlobalPointIndex_loc[iPoint];
3294 Buffer_Receive_Coord_loc[iPoint*
nDim+1],
3295 Local_to_Global_Point[index], config);
3297 Buffer_Receive_Coord_loc[iPoint*
nDim+1],
3298 Buffer_Receive_Coord_loc[iPoint*
nDim+2],
3299 Local_to_Global_Point[index], config);
3300 node[index]->
SetColor(Buffer_Receive_Color_loc[iPoint]);
3301 temp_node_count_periodic++;
3309 index = temp_node_count;
3310 Local_to_Global_Point[index] = Buffer_Receive_GlobalPointIndex_loc[iPoint];
3312 Buffer_Receive_Coord_loc[iPoint*
nDim+1],
3313 Local_to_Global_Point[index], config);
3315 Buffer_Receive_Coord_loc[iPoint*
nDim+1],
3316 Buffer_Receive_Coord_loc[iPoint*
nDim+2],
3317 Local_to_Global_Point[index], config);
3318 node[index]->
SetColor(Buffer_Receive_Color_loc[iPoint]);
3328 index=temp_node_count_ghost;
3329 Local_to_Global_Point[index] = Buffer_Receive_GlobalPointIndex_loc[iPoint];
3331 Buffer_Receive_Coord_loc[iPoint*
nDim+1],
3332 Local_to_Global_Point[index], config);
3334 Buffer_Receive_Coord_loc[iPoint*
nDim+1],
3335 Buffer_Receive_Coord_loc[iPoint*
nDim+2],
3336 Local_to_Global_Point[index], config);
3337 node[index]->
SetColor(Buffer_Receive_Color_loc[iPoint]);
3338 temp_node_count_ghost++;
3343 delete [] Buffer_Receive_Coord_loc;
3344 delete [] Buffer_Receive_Color_loc;
3345 delete [] Buffer_Receive_GlobalPointIndex_loc;
3352 for (iPoint = 0; iPoint < nPointTotal_r_tot; iPoint++) {
3353 Global_to_local_Point_recv[Local_to_Global_Point[iPoint]] = iPoint;
3362 for (iDomain = 0; iDomain < (
unsigned long)
size; iDomain++) {
3364 if ((
unsigned long)
rank != iDomain) {
3370 Buffer_Receive_Triangle_presence[iDomain] =
new unsigned long[nElemTriangle_r[iDomain]];
3371 Buffer_Receive_Quadrilateral_presence[iDomain] =
new unsigned long[nElemQuadrilateral_r[iDomain]];
3372 Buffer_Receive_Tetrahedron_presence[iDomain] =
new unsigned long[nElemTetrahedron_r[iDomain]];
3373 Buffer_Receive_Hexahedron_presence[iDomain] =
new unsigned long[nElemHexahedron_r[iDomain]];
3374 Buffer_Receive_Prism_presence[iDomain] =
new unsigned long[nElemPrism_r[iDomain]];
3375 Buffer_Receive_Pyramid_presence[iDomain] =
new unsigned long[nElemPyramid_r[iDomain]];
3382 SU2_MPI::Recv(&Buffer_Receive_Triangle_presence[iDomain][0],
3389 SU2_MPI::Recv(&Buffer_Receive_Quadrilateral_presence[iDomain][0],
3396 SU2_MPI::Recv(&Buffer_Receive_Tetrahedron_presence[iDomain][0],
3403 SU2_MPI::Recv(&Buffer_Receive_Hexahedron_presence[iDomain][0],
3423 for (iElemTriangle = 0; iElemTriangle < nElemTriangle_r[iDomain]; iElemTriangle++) {
3424 map<unsigned long, bool>::const_iterator MI = Triangle_presence.find(Buffer_Receive_Triangle_presence[iDomain][iElemTriangle]);
3425 if (MI == Triangle_presence.end()) {
3426 Triangle_presence[Buffer_Receive_Triangle_presence[iDomain][iElemTriangle]] =
true;
3431 for (iElemQuadrilateral = 0; iElemQuadrilateral < nElemQuadrilateral_r[iDomain]; iElemQuadrilateral++) {
3432 map<unsigned long, bool>::const_iterator MI = Quadrilateral_presence.find(Buffer_Receive_Quadrilateral_presence[iDomain][iElemQuadrilateral]);
3433 if (MI == Quadrilateral_presence.end()) {
3434 Quadrilateral_presence[Buffer_Receive_Quadrilateral_presence[iDomain][iElemQuadrilateral]] =
true;
3439 for (iElemTetrahedron = 0; iElemTetrahedron < nElemTetrahedron_r[iDomain]; iElemTetrahedron++) {
3440 map<unsigned long, bool>::const_iterator MI = Tetrahedron_presence.find(Buffer_Receive_Tetrahedron_presence[iDomain][iElemTetrahedron]);
3441 if (MI == Tetrahedron_presence.end()) {
3442 Tetrahedron_presence[Buffer_Receive_Tetrahedron_presence[iDomain][iElemTetrahedron]] =
true;
3447 for (iElemHexahedron = 0; iElemHexahedron < nElemHexahedron_r[iDomain]; iElemHexahedron++) {
3448 map<unsigned long, bool>::const_iterator MI = Hexahedron_presence.find(Buffer_Receive_Hexahedron_presence[iDomain][iElemHexahedron]);
3449 if (MI == Hexahedron_presence.end()) {
3450 Hexahedron_presence[Buffer_Receive_Hexahedron_presence[iDomain][iElemHexahedron]] =
true;
3455 for (iElemPrism = 0; iElemPrism < nElemPrism_r[iDomain]; iElemPrism++) {
3456 map<unsigned long, bool>::const_iterator MI = Prism_presence.find(Buffer_Receive_Prism_presence[iDomain][iElemPrism]);
3457 if (MI == Prism_presence.end()) {
3458 Prism_presence[Buffer_Receive_Prism_presence[iDomain][iElemPrism]] =
true;
3463 for (iElemPyramid = 0; iElemPyramid < nElemPyramid_r[iDomain]; iElemPyramid++) {
3464 map<unsigned long, bool>::const_iterator MI = Pyramid_presence.find(Buffer_Receive_Pyramid_presence[iDomain][iElemPyramid]);
3465 if (MI == Pyramid_presence.end()) {
3466 Pyramid_presence[Buffer_Receive_Pyramid_presence[iDomain][iElemPyramid]] =
true;
3477 for (iElemTriangle = 0; iElemTriangle < nElemTriangle_r[iDomain]; iElemTriangle++) {
3478 map<unsigned long, bool>::const_iterator MI = Triangle_presence.find(Buffer_Receive_Triangle_presence_loc[iElemTriangle]);
3479 if (MI == Triangle_presence.end()) {
3480 Triangle_presence[Buffer_Receive_Triangle_presence_loc[iElemTriangle]] =
true;
3485 for (iElemQuadrilateral = 0; iElemQuadrilateral < nElemQuadrilateral_r[iDomain]; iElemQuadrilateral++) {
3486 map<unsigned long, bool>::const_iterator MI = Quadrilateral_presence.find(Buffer_Receive_Quadrilateral_presence_loc[iElemQuadrilateral]);
3487 if (MI == Quadrilateral_presence.end()) {
3488 Quadrilateral_presence[Buffer_Receive_Quadrilateral_presence_loc[iElemQuadrilateral]] =
true;
3493 for (iElemTetrahedron = 0; iElemTetrahedron < nElemTetrahedron_r[iDomain]; iElemTetrahedron++) {
3494 map<unsigned long, bool>::const_iterator MI = Tetrahedron_presence.find(Buffer_Receive_Tetrahedron_presence_loc[iElemTetrahedron]);
3495 if (MI == Tetrahedron_presence.end()) {
3496 Tetrahedron_presence[Buffer_Receive_Tetrahedron_presence_loc[iElemTetrahedron]] =
true;
3501 for (iElemHexahedron = 0; iElemHexahedron < nElemHexahedron_r[iDomain]; iElemHexahedron++) {
3502 map<unsigned long, bool>::const_iterator MI = Hexahedron_presence.find(Buffer_Receive_Hexahedron_presence_loc[iElemHexahedron]);
3503 if (MI == Hexahedron_presence.end()) {
3504 Hexahedron_presence[Buffer_Receive_Hexahedron_presence_loc[iElemHexahedron]] =
true;
3509 for (iElemPrism = 0; iElemPrism < nElemPrism_r[iDomain]; iElemPrism++) {
3510 map<unsigned long, bool>::const_iterator MI = Prism_presence.find(Buffer_Receive_Prism_presence_loc[iElemPrism]);
3511 if (MI == Prism_presence.end()) {
3512 Prism_presence[Buffer_Receive_Prism_presence_loc[iElemPrism]] =
true;
3517 for (iElemPyramid = 0; iElemPyramid < nElemPyramid_r[iDomain]; iElemPyramid++) {
3518 map<unsigned long, bool>::const_iterator MI = Pyramid_presence.find(Buffer_Receive_Pyramid_presence_loc[iElemPyramid]);
3519 if (MI == Pyramid_presence.end()) {
3520 Pyramid_presence[Buffer_Receive_Pyramid_presence_loc[iElemPyramid]] =
true;
3537 nElem = iElem; iElem = 0;
3539 unsigned long iElemTria = 0;
3540 unsigned long iElemRect = 0;
3541 unsigned long iElemTetr = 0;
3542 unsigned long iElemHexa = 0;
3543 unsigned long iElemPris = 0;
3544 unsigned long iElemPyra = 0;
3546 unsigned long iElemRecv = 0;
3550 Triangle_presence.clear();
3551 Quadrilateral_presence.clear();
3552 Tetrahedron_presence.clear();
3553 Hexahedron_presence.clear();
3554 Prism_presence.clear();
3555 Pyramid_presence.clear();
3559 for (iDomain = 0; iDomain < (
unsigned long)
size; iDomain++) {
3561 if ((
unsigned long)
rank != iDomain) {
3567 Buffer_Receive_Triangle =
new unsigned long[nElemTriangle_r[iDomain]*
N_POINTS_TRIANGLE];
3569 Buffer_Receive_Tetrahedron =
new unsigned long[nElemTetrahedron_r[iDomain]*
N_POINTS_TETRAHEDRON];
3570 Buffer_Receive_Hexahedron =
new unsigned long[nElemHexahedron_r[iDomain]*
N_POINTS_HEXAHEDRON];
3571 Buffer_Receive_Prism =
new unsigned long[nElemPrism_r[iDomain]*
N_POINTS_PRISM];
3572 Buffer_Receive_Pyramid =
new unsigned long[nElemPyramid_r[iDomain]*
N_POINTS_PYRAMID];
3573 Buffer_Receive_GlobElem =
new unsigned long[nElemTotal_r[iDomain]];
3625 for (iElemTriangle = 0; iElemTriangle < nElemTriangle_r[iDomain]; iElemTriangle++) {
3626 map<unsigned long, bool>::const_iterator MI = Triangle_presence.find(Buffer_Receive_Triangle_presence[iDomain][iElemTriangle]);
3627 if (MI == Triangle_presence.end()) {
3628 Triangle_presence[Buffer_Receive_Triangle_presence[iDomain][iElemTriangle]] =
true;
3629 elem[iElem] =
new CTriangle(Global_to_local_Point_recv[Buffer_Receive_Triangle[iElemTriangle*3+0]],
3630 Global_to_local_Point_recv[Buffer_Receive_Triangle[iElemTriangle*3+1]],
3631 Global_to_local_Point_recv[Buffer_Receive_Triangle[iElemTriangle*3+2]], 2);
3633 iElem++; iElemTria++;
3638 for (iElemQuadrilateral = 0; iElemQuadrilateral < nElemQuadrilateral_r[iDomain]; iElemQuadrilateral++) {
3639 map<unsigned long, bool>::const_iterator MI = Quadrilateral_presence.find(Buffer_Receive_Quadrilateral_presence[iDomain][iElemQuadrilateral]);
3640 if (MI == Quadrilateral_presence.end()) {
3641 Quadrilateral_presence[Buffer_Receive_Quadrilateral_presence[iDomain][iElemQuadrilateral]] =
true;
3642 elem[iElem] =
new CQuadrilateral(Global_to_local_Point_recv[Buffer_Receive_Quadrilateral[iElemQuadrilateral*4+0]],
3643 Global_to_local_Point_recv[Buffer_Receive_Quadrilateral[iElemQuadrilateral*4+1]],
3644 Global_to_local_Point_recv[Buffer_Receive_Quadrilateral[iElemQuadrilateral*4+2]],
3645 Global_to_local_Point_recv[Buffer_Receive_Quadrilateral[iElemQuadrilateral*4+3]], 2);
3647 iElem++; iElemRect++;
3652 for (iElemTetrahedron = 0; iElemTetrahedron < nElemTetrahedron_r[iDomain]; iElemTetrahedron++) {
3653 map<unsigned long, bool>::const_iterator MI = Tetrahedron_presence.find(Buffer_Receive_Tetrahedron_presence[iDomain][iElemTetrahedron]);
3654 if (MI == Tetrahedron_presence.end()) {
3655 Tetrahedron_presence[Buffer_Receive_Tetrahedron_presence[iDomain][iElemTetrahedron]] =
true;
3656 elem[iElem] =
new CTetrahedron(Global_to_local_Point_recv[Buffer_Receive_Tetrahedron[iElemTetrahedron*4+0]],
3657 Global_to_local_Point_recv[Buffer_Receive_Tetrahedron[iElemTetrahedron*4+1]],
3658 Global_to_local_Point_recv[Buffer_Receive_Tetrahedron[iElemTetrahedron*4+2]],
3659 Global_to_local_Point_recv[Buffer_Receive_Tetrahedron[iElemTetrahedron*4+3]]);
3661 iElem++; iElemTetr++;
3666 for (iElemHexahedron = 0; iElemHexahedron < nElemHexahedron_r[iDomain]; iElemHexahedron++) {
3667 map<unsigned long, bool>::const_iterator MI = Hexahedron_presence.find(Buffer_Receive_Hexahedron_presence[iDomain][iElemHexahedron]);
3668 if (MI == Hexahedron_presence.end()) {
3669 Hexahedron_presence[Buffer_Receive_Hexahedron_presence[iDomain][iElemHexahedron]] =
true;
3670 elem[iElem] =
new CHexahedron(Global_to_local_Point_recv[Buffer_Receive_Hexahedron[iElemHexahedron*8+0]],
3671 Global_to_local_Point_recv[Buffer_Receive_Hexahedron[iElemHexahedron*8+1]],
3672 Global_to_local_Point_recv[Buffer_Receive_Hexahedron[iElemHexahedron*8+2]],
3673 Global_to_local_Point_recv[Buffer_Receive_Hexahedron[iElemHexahedron*8+3]],
3674 Global_to_local_Point_recv[Buffer_Receive_Hexahedron[iElemHexahedron*8+4]],
3675 Global_to_local_Point_recv[Buffer_Receive_Hexahedron[iElemHexahedron*8+5]],
3676 Global_to_local_Point_recv[Buffer_Receive_Hexahedron[iElemHexahedron*8+6]],
3677 Global_to_local_Point_recv[Buffer_Receive_Hexahedron[iElemHexahedron*8+7]]);
3679 iElem++; iElemHexa++;
3684 for (iElemPrism = 0; iElemPrism < nElemPrism_r[iDomain]; iElemPrism++) {
3685 map<unsigned long, bool>::const_iterator MI = Prism_presence.find(Buffer_Receive_Prism_presence[iDomain][iElemPrism]);
3686 if (MI == Prism_presence.end()) {
3687 Prism_presence[Buffer_Receive_Prism_presence[iDomain][iElemPrism]] =
true;
3688 elem[iElem] =
new CPrism(Global_to_local_Point_recv[Buffer_Receive_Prism[iElemPrism*6+0]],
3689 Global_to_local_Point_recv[Buffer_Receive_Prism[iElemPrism*6+1]],
3690 Global_to_local_Point_recv[Buffer_Receive_Prism[iElemPrism*6+2]],
3691 Global_to_local_Point_recv[Buffer_Receive_Prism[iElemPrism*6+3]],
3692 Global_to_local_Point_recv[Buffer_Receive_Prism[iElemPrism*6+4]],
3693 Global_to_local_Point_recv[Buffer_Receive_Prism[iElemPrism*6+5]]);
3695 iElem++; iElemPris++;
3700 for (iElemPyramid = 0; iElemPyramid < nElemPyramid_r[iDomain]; iElemPyramid++) {
3701 map<unsigned long, bool>::const_iterator MI = Pyramid_presence.find(Buffer_Receive_Pyramid_presence[iDomain][iElemPyramid]);
3702 if (MI == Pyramid_presence.end()) {
3703 Pyramid_presence[Buffer_Receive_Pyramid_presence[iDomain][iElemPyramid]] =
true;
3704 elem[iElem] =
new CPyramid(Global_to_local_Point_recv[Buffer_Receive_Pyramid[iElemPyramid*5+0]],
3705 Global_to_local_Point_recv[Buffer_Receive_Pyramid[iElemPyramid*5+1]],
3706 Global_to_local_Point_recv[Buffer_Receive_Pyramid[iElemPyramid*5+2]],
3707 Global_to_local_Point_recv[Buffer_Receive_Pyramid[iElemPyramid*5+3]],
3708 Global_to_local_Point_recv[Buffer_Receive_Pyramid[iElemPyramid*5+4]]);
3710 iElem++; iElemPyra++;
3717 delete[] Buffer_Receive_Triangle;
3718 delete[] Buffer_Receive_Quadrilateral;
3719 delete[] Buffer_Receive_Tetrahedron;
3720 delete[] Buffer_Receive_Hexahedron;
3721 delete[] Buffer_Receive_Prism;
3722 delete[] Buffer_Receive_Pyramid;
3723 delete[] Buffer_Receive_GlobElem;
3725 delete[] Buffer_Receive_Triangle_presence[iDomain];
3726 delete[] Buffer_Receive_Quadrilateral_presence[iDomain];
3727 delete[] Buffer_Receive_Tetrahedron_presence[iDomain];
3728 delete[] Buffer_Receive_Hexahedron_presence[iDomain];
3729 delete[] Buffer_Receive_Prism_presence[iDomain];
3730 delete[] Buffer_Receive_Pyramid_presence[iDomain];
3740 for (iElemTriangle = 0; iElemTriangle < nElemTriangle_r[iDomain]; iElemTriangle++) {
3741 map<unsigned long, bool>::const_iterator MI = Triangle_presence.find(Buffer_Receive_Triangle_presence_loc[iElemTriangle]);
3742 if (MI == Triangle_presence.end()) {
3743 Triangle_presence[Buffer_Receive_Triangle_presence_loc[iElemTriangle]] =
true;
3744 elem[iElem] =
new CTriangle(Global_to_local_Point_recv[Buffer_Receive_Triangle_loc[iElemTriangle*3+0]],
3745 Global_to_local_Point_recv[Buffer_Receive_Triangle_loc[iElemTriangle*3+1]],
3746 Global_to_local_Point_recv[Buffer_Receive_Triangle_loc[iElemTriangle*3+2]], 2);
3748 iElem++; iElemTria++;
3753 for (iElemQuadrilateral = 0; iElemQuadrilateral < nElemQuadrilateral_r[iDomain]; iElemQuadrilateral++) {
3754 map<unsigned long, bool>::const_iterator MI = Quadrilateral_presence.find(Buffer_Receive_Quadrilateral_presence_loc[iElemQuadrilateral]);
3755 if (MI == Quadrilateral_presence.end()) {
3756 Quadrilateral_presence[Buffer_Receive_Quadrilateral_presence_loc[iElemQuadrilateral]] =
true;
3757 elem[iElem] =
new CQuadrilateral(Global_to_local_Point_recv[Buffer_Receive_Quadrilateral_loc[iElemQuadrilateral*4+0]],
3758 Global_to_local_Point_recv[Buffer_Receive_Quadrilateral_loc[iElemQuadrilateral*4+1]],
3759 Global_to_local_Point_recv[Buffer_Receive_Quadrilateral_loc[iElemQuadrilateral*4+2]],
3760 Global_to_local_Point_recv[Buffer_Receive_Quadrilateral_loc[iElemQuadrilateral*4+3]], 2);
3762 iElem++; iElemRect++;
3767 for (iElemTetrahedron = 0; iElemTetrahedron < nElemTetrahedron_r[iDomain]; iElemTetrahedron++) {
3768 map<unsigned long, bool>::const_iterator MI = Tetrahedron_presence.find(Buffer_Receive_Tetrahedron_presence_loc[iElemTetrahedron]);
3769 if (MI == Tetrahedron_presence.end()) {
3770 Tetrahedron_presence[Buffer_Receive_Tetrahedron_presence_loc[iElemTetrahedron]] =
true;
3771 elem[iElem] =
new CTetrahedron(Global_to_local_Point_recv[Buffer_Receive_Tetrahedron_loc[iElemTetrahedron*4+0]],
3772 Global_to_local_Point_recv[Buffer_Receive_Tetrahedron_loc[iElemTetrahedron*4+1]],
3773 Global_to_local_Point_recv[Buffer_Receive_Tetrahedron_loc[iElemTetrahedron*4+2]],
3774 Global_to_local_Point_recv[Buffer_Receive_Tetrahedron_loc[iElemTetrahedron*4+3]]);
3776 iElem++; iElemTetr++;
3781 for (iElemHexahedron = 0; iElemHexahedron < nElemHexahedron_r[iDomain]; iElemHexahedron++) {
3782 map<unsigned long, bool>::const_iterator MI = Hexahedron_presence.find(Buffer_Receive_Hexahedron_presence_loc[iElemHexahedron]);
3783 if (MI == Hexahedron_presence.end()) {
3784 Hexahedron_presence[Buffer_Receive_Hexahedron_presence_loc[iElemHexahedron]] =
true;
3785 elem[iElem] =
new CHexahedron(Global_to_local_Point_recv[Buffer_Receive_Hexahedron_loc[iElemHexahedron*8+0]],
3786 Global_to_local_Point_recv[Buffer_Receive_Hexahedron_loc[iElemHexahedron*8+1]],
3787 Global_to_local_Point_recv[Buffer_Receive_Hexahedron_loc[iElemHexahedron*8+2]],
3788 Global_to_local_Point_recv[Buffer_Receive_Hexahedron_loc[iElemHexahedron*8+3]],
3789 Global_to_local_Point_recv[Buffer_Receive_Hexahedron_loc[iElemHexahedron*8+4]],
3790 Global_to_local_Point_recv[Buffer_Receive_Hexahedron_loc[iElemHexahedron*8+5]],
3791 Global_to_local_Point_recv[Buffer_Receive_Hexahedron_loc[iElemHexahedron*8+6]],
3792 Global_to_local_Point_recv[Buffer_Receive_Hexahedron_loc[iElemHexahedron*8+7]]);
3794 iElem++; iElemHexa++;
3799 for (iElemPrism = 0; iElemPrism < nElemPrism_r[iDomain]; iElemPrism++) {
3800 map<unsigned long, bool>::const_iterator MI = Prism_presence.find(Buffer_Receive_Prism_presence_loc[iElemPrism]);
3801 if (MI == Prism_presence.end()) {
3802 Prism_presence[Buffer_Receive_Prism_presence_loc[iElemPrism]] =
true;
3803 elem[iElem] =
new CPrism(Global_to_local_Point_recv[Buffer_Receive_Prism_loc[iElemPrism*6+0]],
3804 Global_to_local_Point_recv[Buffer_Receive_Prism_loc[iElemPrism*6+1]],
3805 Global_to_local_Point_recv[Buffer_Receive_Prism_loc[iElemPrism*6+2]],
3806 Global_to_local_Point_recv[Buffer_Receive_Prism_loc[iElemPrism*6+3]],
3807 Global_to_local_Point_recv[Buffer_Receive_Prism_loc[iElemPrism*6+4]],
3808 Global_to_local_Point_recv[Buffer_Receive_Prism_loc[iElemPrism*6+5]]);
3810 iElem++; iElemPris++;
3815 for (iElemPyramid = 0; iElemPyramid < nElemPyramid_r[iDomain]; iElemPyramid++) {
3816 map<unsigned long, bool>::const_iterator MI = Pyramid_presence.find(Buffer_Receive_Pyramid_presence_loc[iElemPyramid]);
3817 if (MI == Pyramid_presence.end()) {
3818 Pyramid_presence[Buffer_Receive_Pyramid_presence_loc[iElemPyramid]] =
true;
3819 elem[iElem] =
new CPyramid(Global_to_local_Point_recv[Buffer_Receive_Pyramid_loc[iElemPyramid*5+0]],
3820 Global_to_local_Point_recv[Buffer_Receive_Pyramid_loc[iElemPyramid*5+1]],
3821 Global_to_local_Point_recv[Buffer_Receive_Pyramid_loc[iElemPyramid*5+2]],
3822 Global_to_local_Point_recv[Buffer_Receive_Pyramid_loc[iElemPyramid*5+3]],
3823 Global_to_local_Point_recv[Buffer_Receive_Pyramid_loc[iElemPyramid*5+4]]);
3825 iElem++; iElemPyra++;
3832 delete[] Buffer_Receive_Triangle_loc;
3833 delete[] Buffer_Receive_Quadrilateral_loc;
3834 delete[] Buffer_Receive_Tetrahedron_loc;
3835 delete[] Buffer_Receive_Hexahedron_loc;
3836 delete[] Buffer_Receive_Prism_loc;
3837 delete[] Buffer_Receive_Pyramid_loc;
3838 delete[] Buffer_Receive_GlobElem_loc;
3840 delete[] Buffer_Receive_Triangle_presence_loc;
3841 delete[] Buffer_Receive_Quadrilateral_presence_loc;
3842 delete[] Buffer_Receive_Tetrahedron_presence_loc;
3843 delete[] Buffer_Receive_Hexahedron_presence_loc;
3844 delete[] Buffer_Receive_Prism_presence_loc;
3845 delete[] Buffer_Receive_Pyramid_presence_loc;
3851 for (iDomain = 0; iDomain < (
unsigned long)
size; iDomain++) {
3859 delete [] Buffer_Send_Coord;
3860 delete [] Buffer_Send_GlobalPointIndex;
3861 delete [] Buffer_Send_Color;
3862 delete [] Buffer_Send_Triangle;
3863 delete [] Buffer_Send_Quadrilateral;
3864 delete [] Buffer_Send_Tetrahedron;
3865 delete [] Buffer_Send_Hexahedron;
3866 delete [] Buffer_Send_Prism;
3867 delete [] Buffer_Send_Pyramid;
3868 delete [] Buffer_Send_GlobElem;
3869 delete [] Buffer_Send_BoundLine;
3870 delete [] Buffer_Send_BoundTriangle;
3871 delete [] Buffer_Send_BoundQuadrilateral;
3872 delete [] Buffer_Send_Local2Global_Marker;
3874 delete [] Buffer_Send_SendDomain_Periodic;
3875 delete [] Buffer_Send_SendDomain_PeriodicTrans;
3876 delete [] Buffer_Send_SendDomain_PeriodicReceptor;
3877 delete [] Buffer_Send_ReceivedDomain_Periodic;
3878 delete [] Buffer_Send_ReceivedDomain_PeriodicTrans;
3879 delete [] Buffer_Send_ReceivedDomain_PeriodicDonor;
3882 delete [] Buffer_Receive_Triangle_presence;
3883 delete [] Buffer_Receive_Quadrilateral_presence;
3884 delete [] Buffer_Receive_Tetrahedron_presence;
3885 delete [] Buffer_Receive_Hexahedron_presence;
3886 delete [] Buffer_Receive_Prism_presence;
3887 delete [] Buffer_Receive_Pyramid_presence;
3890 delete [] Local_to_global_Triangle;
3891 delete [] Local_to_global_Quadrilateral;
3892 delete [] Local_to_global_Tetrahedron;
3893 delete [] Local_to_global_Hexahedron;
3894 delete [] Local_to_global_Prism;
3895 delete [] Local_to_global_Pyramid;
3902 unsigned long Local_nElem =
nElem;
3910 cout <<
Global_nElem <<
" interior elements including halo cells. " << endl;
3976 VertexIn =
new bool*[geometry->
GetnMarker()];
3978 for (iMarker = 0; iMarker < geometry->
GetnMarker(); iMarker++)
3981 Buffer_Send_nDim = geometry->
GetnDim();
3982 Buffer_Send_nZone = geometry->
GetnZone();
3984 Buffer_Send_Center =
new su2double[Buffer_Send_nPeriodic*3];
3985 Buffer_Send_Rotation =
new su2double[Buffer_Send_nPeriodic*3];
3986 Buffer_Send_Translate =
new su2double[Buffer_Send_nPeriodic*3];
3988 Buffer_Send_nSendDomain_Periodic =
new unsigned long[nDomain];
3989 Buffer_Send_nReceivedDomain_Periodic =
new unsigned long[nDomain];
3994 Marker_All_SendRecv_Copy =
new short[geometry->
GetnMarker()];
3995 Marker_All_TagBound_Copy =
new string[geometry->
GetnMarker()];
3997 for (iMarker = 0; iMarker < geometry->
GetnMarker(); iMarker++) {
4004 for (iDomain = 0; iDomain < nDomain; iDomain++) {
4027 Buffer_Send_nMarkerDomain = 0;
4028 Buffer_Send_nBoundLineTotal = 0;
4029 Buffer_Send_nBoundTriangleTotal = 0;
4030 Buffer_Send_nBoundQuadrilateralTotal = 0;
4032 for (iMarker = 0; iMarker < geometry->
GetnMarker(); iMarker++) {
4033 Buffer_Send_nVertexDomain[iMarker] = 0;
4034 Buffer_Send_nBoundLine[iMarker] = 0;
4035 Buffer_Send_nBoundTriangle[iMarker] = 0;
4036 Buffer_Send_nBoundQuadrilateral[iMarker] = 0;
4037 Buffer_Send_Marker_All_SendRecv[iMarker] = Marker_All_SendRecv_Copy[iMarker];
4039 Marker_All_TagBound_Copy[iMarker].c_str());
4042 for (iMarker = 0; iMarker < geometry->
GetnMarker(); iMarker++) {
4045 MarkerIn[iMarker] =
false;
4046 Buffer_Send_nVertexDomain[Buffer_Send_nMarkerDomain] = 0;
4048 for (iVertex = 0; iVertex < geometry->
GetnElem_Bound(iMarker); iVertex++) {
4049 VertexIn[iMarker][iVertex] =
false;
4050 for (iNode = 0; iNode < geometry->
bound[iMarker][iVertex]->
GetnNodes(); iNode++) {
4051 iPoint = geometry->
bound[iMarker][iVertex]->
GetNode(iNode);
4052 if (local_colour_values[iPoint] == iDomain) VertexIn[iMarker][iVertex] =
true;
4056 if (VertexIn[iMarker][iVertex]) {
4059 Buffer_Send_nBoundLine[Buffer_Send_nMarkerDomain]++;
4060 Buffer_Send_nBoundLineTotal++;
4063 Buffer_Send_nBoundTriangle[Buffer_Send_nMarkerDomain]++;
4064 Buffer_Send_nBoundTriangleTotal++;
4067 Buffer_Send_nBoundQuadrilateral[Buffer_Send_nMarkerDomain]++;
4068 Buffer_Send_nBoundQuadrilateralTotal++;
4073 Buffer_Send_nVertexDomain[Buffer_Send_nMarkerDomain]++;
4074 MarkerIn[iMarker] =
true;
4080 if (MarkerIn[iMarker]) { Buffer_Send_nMarkerDomain++; }
4087 for (iPeriodic = 0; iPeriodic < Buffer_Send_nPeriodic; iPeriodic++) {
4088 for (iDim = 0; iDim < 3; iDim++) {
4089 Buffer_Send_Center[iDim+iPeriodic*3] = config->
GetPeriodicCenter(iPeriodic)[iDim];
4097 for (jDomain = 0; jDomain < nDomain; jDomain++) {
4098 Buffer_Send_nSendDomain_Periodic[jDomain] = 0;
4099 Buffer_Send_nReceivedDomain_Periodic[jDomain] = 0;
4101 Buffer_Send_nTotalSendDomain_Periodic = 0;
4102 Buffer_Send_nTotalReceivedDomain_Periodic = 0;
4104 for (iMarker = 0; iMarker < geometry->
GetnMarker(); iMarker++) {
4106 for (iVertex = 0; iVertex < geometry->
GetnElem_Bound(iMarker); iVertex++) {
4107 iPoint = geometry->
bound[iMarker][iVertex]->
GetNode(0);
4108 if (iDomain == local_colour_values[iPoint]) {
4114 for (jMarker = 0; jMarker < geometry->
GetnMarker(); jMarker++) {
4117 jPoint = geometry->
bound[jMarker][iVertex]->
GetNode(0);
4118 ReceptorColor = local_colour_values[jPoint];
4122 Buffer_Send_nSendDomain_Periodic[ReceptorColor]++;
4123 Buffer_Send_nTotalSendDomain_Periodic++;
4130 for (jMarker = 0; jMarker < geometry->
GetnMarker(); jMarker++) {
4133 jPoint = geometry->
bound[jMarker][iVertex]->
GetNode(0);
4134 DonorColor = local_colour_values[jPoint];
4138 Buffer_Send_nReceivedDomain_Periodic[DonorColor]++;
4139 Buffer_Send_nTotalReceivedDomain_Periodic++;
4149 Buffer_Send_BoundLine =
new unsigned long[Buffer_Send_nBoundLineTotal*
N_POINTS_LINE];
4150 Buffer_Send_BoundTriangle =
new unsigned long[Buffer_Send_nBoundTriangleTotal*
N_POINTS_TRIANGLE];
4151 Buffer_Send_BoundQuadrilateral =
new unsigned long[Buffer_Send_nBoundQuadrilateralTotal*
N_POINTS_QUADRILATERAL];
4152 Buffer_Send_Local2Global_Marker =
new unsigned long[Buffer_Send_nMarkerDomain];
4154 Buffer_Send_SendDomain_Periodic =
new unsigned long[Buffer_Send_nTotalSendDomain_Periodic];
4155 Buffer_Send_SendDomain_PeriodicTrans =
new unsigned long[Buffer_Send_nTotalSendDomain_Periodic];
4156 Buffer_Send_SendDomain_PeriodicReceptor =
new unsigned long[Buffer_Send_nTotalSendDomain_Periodic];
4157 Buffer_Send_ReceivedDomain_Periodic =
new unsigned long[Buffer_Send_nTotalReceivedDomain_Periodic];
4158 Buffer_Send_ReceivedDomain_PeriodicTrans =
new unsigned long[Buffer_Send_nTotalReceivedDomain_Periodic];
4159 Buffer_Send_ReceivedDomain_PeriodicDonor =
new unsigned long[Buffer_Send_nTotalReceivedDomain_Periodic];
4247 nDim = Buffer_Send_nDim;
4248 nZone = Buffer_Send_nZone;
4250 nPeriodic = Buffer_Send_nPeriodic;
4254 nBoundLineTotal = Buffer_Send_nBoundLineTotal;
4255 nBoundTriangleTotal = Buffer_Send_nBoundTriangleTotal;
4256 nBoundQuadrilateralTotal = Buffer_Send_nBoundQuadrilateralTotal;
4257 nMarkerDomain = Buffer_Send_nMarkerDomain;
4259 for (iMarker = 0; iMarker < nMarker_Max; iMarker++) {
4260 nVertexDomain[iMarker] = Buffer_Send_nVertexDomain[iMarker];
4261 nBoundLine[iMarker] = Buffer_Send_nBoundLine[iMarker];
4262 nBoundTriangle[iMarker] = Buffer_Send_nBoundTriangle[iMarker];
4263 nBoundQuadrilateral[iMarker] = Buffer_Send_nBoundQuadrilateral[iMarker];
4269 Buffer_Receive_Center =
new su2double[nPeriodic*3];
4270 Buffer_Receive_Rotation =
new su2double[nPeriodic*3];
4271 Buffer_Receive_Translate =
new su2double[nPeriodic*3];
4273 for (iter = 0; iter < nPeriodic*3; iter++) {
4274 Buffer_Receive_Center[iter] = Buffer_Send_Center[iter];
4275 Buffer_Receive_Rotation[iter] = Buffer_Send_Rotation[iter];
4276 Buffer_Receive_Translate[iter] = Buffer_Send_Translate[iter];
4279 nTotalSendDomain_Periodic = Buffer_Send_nTotalSendDomain_Periodic;
4280 nTotalReceivedDomain_Periodic = Buffer_Send_nTotalReceivedDomain_Periodic;
4282 for (iter = 0; iter < nDomain; iter++) {
4283 nSendDomain_Periodic[iter] = Buffer_Send_nSendDomain_Periodic[iter];
4284 nReceivedDomain_Periodic[iter] = Buffer_Send_nReceivedDomain_Periodic[iter];
4292 if ((
unsigned long)
rank == iDomain) {
4360 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
4370 Buffer_Receive_Center =
new su2double[nPeriodic*3];
4371 Buffer_Receive_Rotation =
new su2double[nPeriodic*3];
4372 Buffer_Receive_Translate =
new su2double[nPeriodic*3];
4415 for (iPeriodic = 0; iPeriodic < nPeriodic; iPeriodic++) {
4421 for (iDim = 0; iDim < 3; iDim++) {
4422 center[iDim] = Buffer_Receive_Center[iDim+iPeriodic*3];
4423 rotation[iDim] = Buffer_Receive_Rotation[iDim+iPeriodic*3];
4424 translate[iDim] = Buffer_Receive_Translate[iDim+iPeriodic*3];
4430 delete [] center;
delete [] rotation;
delete [] translate;
4436 delete [] Buffer_Receive_Center;
4437 delete [] Buffer_Receive_Rotation;
4438 delete [] Buffer_Receive_Translate;
4442 Buffer_Receive_BoundLine =
new unsigned long[nBoundLineTotal*2];
4443 Buffer_Receive_BoundTriangle =
new unsigned long[nBoundTriangleTotal*3];
4444 Buffer_Receive_BoundQuadrilateral =
new unsigned long[nBoundQuadrilateralTotal*4];
4445 Buffer_Receive_Local2Global_Marker =
new unsigned long[nMarkerDomain];
4447 Buffer_Receive_SendDomain_Periodic =
new unsigned long[nTotalSendDomain_Periodic];
4448 Buffer_Receive_SendDomain_PeriodicTrans =
new unsigned long[nTotalSendDomain_Periodic];
4449 Buffer_Receive_SendDomain_PeriodicReceptor =
new unsigned long[nTotalSendDomain_Periodic];
4450 Buffer_Receive_ReceivedDomain_Periodic =
new unsigned long[nTotalReceivedDomain_Periodic];
4451 Buffer_Receive_ReceivedDomain_PeriodicTrans =
new unsigned long[nTotalReceivedDomain_Periodic];
4452 Buffer_Receive_ReceivedDomain_PeriodicDonor =
new unsigned long[nTotalReceivedDomain_Periodic];
4463 iBoundLineTotal = 0; iBoundTriangleTotal = 0; iBoundQuadrilateralTotal = 0;
4465 for (iMarker = 0; iMarker < geometry->
GetnMarker(); iMarker++) {
4467 for (iVertex = 0; iVertex < geometry->
GetnElem_Bound(iMarker); iVertex++) {
4469 if (VertexIn[iMarker][iVertex]) {
4473 for (iNode = 0; iNode < geometry->
bound[iMarker][iVertex]->
GetnNodes(); iNode++) {
4474 vnodes_local[iNode] = geometry->
bound[iMarker][iVertex]->
GetNode(iNode);
4479 Buffer_Send_BoundLine[
N_POINTS_LINE*iBoundLineTotal+0] = vnodes_local[0];
4480 Buffer_Send_BoundLine[
N_POINTS_LINE*iBoundLineTotal+1] = vnodes_local[1];
4484 Buffer_Send_BoundTriangle[
N_POINTS_TRIANGLE*iBoundTriangleTotal+0] = vnodes_local[0];
4485 Buffer_Send_BoundTriangle[
N_POINTS_TRIANGLE*iBoundTriangleTotal+1] = vnodes_local[1];
4486 Buffer_Send_BoundTriangle[
N_POINTS_TRIANGLE*iBoundTriangleTotal+2] = vnodes_local[2];
4487 iBoundTriangleTotal++;
4494 iBoundQuadrilateralTotal++;
4500 Buffer_Send_Local2Global_Marker[iMarkerDomain] = iMarker;
4508 iTotalSendDomain_Periodic = 0;
4509 iTotalReceivedDomain_Periodic = 0;
4511 for (iMarker = 0; iMarker < geometry->
GetnMarker(); iMarker++) {
4515 for (iVertex = 0; iVertex < geometry->
GetnElem_Bound(iMarker); iVertex++) {
4517 iPoint = geometry->
bound[iMarker][iVertex]->
GetNode(0);
4520 if (iDomain == local_colour_values[iPoint]) {
4529 for (jMarker = 0; jMarker < geometry->
GetnMarker(); jMarker++) {
4532 jPoint = geometry->
bound[jMarker][iVertex]->
GetNode(0);
4533 ReceptorColor = local_colour_values[jPoint];
4539 Buffer_Send_SendDomain_Periodic[iTotalSendDomain_Periodic] = iPoint;
4540 Buffer_Send_SendDomain_PeriodicTrans[iTotalSendDomain_Periodic] = Transformation;
4541 Buffer_Send_SendDomain_PeriodicReceptor[iTotalSendDomain_Periodic] = ReceptorColor;
4543 iTotalSendDomain_Periodic++;
4553 for (jMarker = 0; jMarker < geometry->
GetnMarker(); jMarker++) {
4556 jPoint = geometry->
bound[jMarker][iVertex]->
GetNode(0);
4557 DonorColor = local_colour_values[jPoint];
4563 Buffer_Send_ReceivedDomain_Periodic[iTotalReceivedDomain_Periodic] = iPoint;
4564 Buffer_Send_ReceivedDomain_PeriodicTrans[iTotalReceivedDomain_Periodic] = Transformation;
4565 Buffer_Send_ReceivedDomain_PeriodicDonor[iTotalReceivedDomain_Periodic] = DonorColor;
4567 iTotalReceivedDomain_Periodic++;
4631 for (iter = 0; iter < Buffer_Send_nBoundLineTotal*
N_POINTS_LINE; iter++)
4632 Buffer_Receive_BoundLine[iter] = Buffer_Send_BoundLine[iter];
4634 for (iter = 0; iter < Buffer_Send_nBoundTriangleTotal*
N_POINTS_TRIANGLE; iter++)
4635 Buffer_Receive_BoundTriangle[iter] = Buffer_Send_BoundTriangle[iter];
4638 Buffer_Receive_BoundQuadrilateral[iter] = Buffer_Send_BoundQuadrilateral[iter];
4640 for (iter = 0; iter < Buffer_Send_nMarkerDomain; iter++)
4641 Buffer_Receive_Local2Global_Marker[iter] = Buffer_Send_Local2Global_Marker[iter];
4643 for (iter = 0; iter < Buffer_Send_nTotalSendDomain_Periodic; iter++) {
4644 Buffer_Receive_SendDomain_Periodic[iter] = Buffer_Send_SendDomain_Periodic[iter];
4645 Buffer_Receive_SendDomain_PeriodicTrans[iter] = Buffer_Send_SendDomain_PeriodicTrans[iter];
4646 Buffer_Receive_SendDomain_PeriodicReceptor[iter] = Buffer_Send_SendDomain_PeriodicReceptor[iter];
4649 for (iter = 0; iter < Buffer_Send_nTotalReceivedDomain_Periodic; iter++) {
4650 Buffer_Receive_ReceivedDomain_Periodic[iter] = Buffer_Send_ReceivedDomain_Periodic[iter];
4651 Buffer_Receive_ReceivedDomain_PeriodicTrans[iter] = Buffer_Send_ReceivedDomain_PeriodicTrans[iter];
4652 Buffer_Receive_ReceivedDomain_PeriodicDonor[iter] = Buffer_Send_ReceivedDomain_PeriodicDonor[iter];
4657 delete[] Buffer_Send_BoundLine;
4658 delete[] Buffer_Send_BoundTriangle;
4659 delete[] Buffer_Send_BoundQuadrilateral;
4660 delete[] Buffer_Send_Local2Global_Marker;
4662 delete[] Buffer_Send_SendDomain_Periodic;
4663 delete[] Buffer_Send_SendDomain_PeriodicTrans;
4664 delete[] Buffer_Send_SendDomain_PeriodicReceptor;
4665 delete[] Buffer_Send_ReceivedDomain_Periodic;
4666 delete[] Buffer_Send_ReceivedDomain_PeriodicTrans;
4667 delete[] Buffer_Send_ReceivedDomain_PeriodicDonor;
4671 if ((
unsigned long)
rank == iDomain) {
4737 Local_to_Global_Marker =
new unsigned short[nMarker_Max];
4739 string *TagBound_Copy =
new string[nMarker_Max];
4740 short *SendRecv_Copy =
new short[nMarker_Max];
4742 for (iMarker = 0; iMarker <
nMarker; iMarker++)
4747 bound[iMarker] = NULL;
4749 for (iMarker = 0; iMarker <
nMarker; iMarker++)
4753 iBoundLineTotal = 0;
4754 iBoundTriangleTotal = 0;
4755 iBoundQuadrilateralTotal = 0;
4761 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
4765 for (iBoundLine = 0; iBoundLine < nBoundLine[iMarker]; iBoundLine++) {
4766 bound[iMarker][iVertexDomain] =
new CLine(Global_to_local_Point_recv[Buffer_Receive_BoundLine[iBoundLineTotal*2+0]],
4767 Global_to_local_Point_recv[Buffer_Receive_BoundLine[iBoundLineTotal*2+1]], 2);
4768 iVertexDomain++; iBoundLineTotal++;
4770 for (iBoundTriangle = 0; iBoundTriangle < nBoundTriangle[iMarker]; iBoundTriangle++) {
4771 bound[iMarker][iVertexDomain] =
new CTriangle(Global_to_local_Point_recv[Buffer_Receive_BoundTriangle[iBoundTriangleTotal*3+0]],
4772 Global_to_local_Point_recv[Buffer_Receive_BoundTriangle[iBoundTriangleTotal*3+1]],
4773 Global_to_local_Point_recv[Buffer_Receive_BoundTriangle[iBoundTriangleTotal*3+2]], 3);
4774 iVertexDomain++; iBoundTriangleTotal++;
4776 for (iBoundQuadrilateral = 0; iBoundQuadrilateral < nBoundQuadrilateral[iMarker]; iBoundQuadrilateral++) {
4777 bound[iMarker][iVertexDomain] =
new CQuadrilateral(Global_to_local_Point_recv[Buffer_Receive_BoundQuadrilateral[iBoundQuadrilateralTotal*4+0]],
4778 Global_to_local_Point_recv[Buffer_Receive_BoundQuadrilateral[iBoundQuadrilateralTotal*4+1]],
4779 Global_to_local_Point_recv[Buffer_Receive_BoundQuadrilateral[iBoundQuadrilateralTotal*4+2]],
4780 Global_to_local_Point_recv[Buffer_Receive_BoundQuadrilateral[iBoundQuadrilateralTotal*4+3]], 3);
4781 iVertexDomain++; iBoundQuadrilateralTotal++;
4784 Local_to_Global_Marker[iMarker] = Buffer_Receive_Local2Global_Marker[iMarker];
4790 TagBound_Copy[iMarker] = Grid_Marker;
4791 SendRecv_Copy[iMarker] = SendRecv;
4801 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
4811 for (jDomain = 0; jDomain < nDomain; jDomain++) {
4813 if (nSendDomain_Periodic[jDomain] != 0) {
4818 for (iTotalSendDomain_Periodic = 0; iTotalSendDomain_Periodic < nTotalSendDomain_Periodic; iTotalSendDomain_Periodic++) {
4819 if (Buffer_Receive_SendDomain_PeriodicReceptor[iTotalSendDomain_Periodic] == jDomain) {
4820 bound[
nMarker][iVertex] =
new CVertexMPI(Global_to_local_Point_recv[Buffer_Receive_SendDomain_Periodic[iTotalSendDomain_Periodic]],
nDim);
4822 nVertexDomain[
nMarker]++; iVertex++;
4831 if (nReceivedDomain_Periodic[jDomain] != 0) {
4836 for (iTotalReceivedDomain_Periodic = 0; iTotalReceivedDomain_Periodic < nTotalReceivedDomain_Periodic; iTotalReceivedDomain_Periodic++) {
4837 if (Buffer_Receive_ReceivedDomain_PeriodicDonor[iTotalReceivedDomain_Periodic] == jDomain) {
4838 bound[
nMarker][iVertex] =
new CVertexMPI(Global_to_local_Point_recv[Buffer_Receive_ReceivedDomain_Periodic[iTotalReceivedDomain_Periodic]],
nDim);
4840 nVertexDomain[
nMarker]++; iVertex++;
4851 delete[] TagBound_Copy;
4852 delete[] SendRecv_Copy;
4854 delete[] Buffer_Receive_BoundLine;
4855 delete[] Buffer_Receive_BoundTriangle;
4856 delete[] Buffer_Receive_BoundQuadrilateral;
4857 delete[] Buffer_Receive_Local2Global_Marker;
4859 delete[] Buffer_Receive_SendDomain_Periodic;
4860 delete[] Buffer_Receive_SendDomain_PeriodicTrans;
4861 delete[] Buffer_Receive_SendDomain_PeriodicReceptor;
4862 delete[] Buffer_Receive_ReceivedDomain_Periodic;
4863 delete[] Buffer_Receive_ReceivedDomain_PeriodicTrans;
4864 delete[] Buffer_Receive_ReceivedDomain_PeriodicDonor;
4878 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
4884 unsigned long Local_nPoint =
nPoint;
4898 cout <<
Global_nPoint <<
" vertices including ghost points. " << endl;
4901 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
4909 for (iMarker = 0; iMarker < 2; iMarker++){
4927 for (iMarker = 0; iMarker <
nMarker; iMarker++){
4966 delete [] nPointTotal_s;
4967 delete [] nPointDomainTotal_s;
4968 delete [] nPointGhost_s;
4969 delete [] nPointPeriodic_s;
4970 delete [] nElemTotal_s;
4971 delete [] nElemTriangle_s;
4972 delete [] nElemQuadrilateral_s;
4973 delete [] nElemTetrahedron_s;
4974 delete [] nElemHexahedron_s;
4975 delete [] nElemPrism_s;
4976 delete [] nElemPyramid_s;
4979 delete [] nPointTotal_r;
4980 delete [] nPointDomainTotal_r;
4981 delete [] nPointGhost_r;
4982 delete [] nPointPeriodic_r;
4983 delete [] nElemTotal_r;
4984 delete [] nElemTriangle_r;
4985 delete [] nElemQuadrilateral_r;
4986 delete [] nElemTetrahedron_r;
4987 delete [] nElemHexahedron_r;
4988 delete [] nElemPrism_r;
4989 delete [] nElemPyramid_r;
4994 delete [] Buffer_Send_Center;
4995 delete [] Buffer_Send_Rotation;
4996 delete [] Buffer_Send_Translate;
4997 delete [] Buffer_Send_nSendDomain_Periodic;
4998 delete [] Buffer_Send_nReceivedDomain_Periodic;
4999 delete [] Marker_All_SendRecv_Copy;
5000 delete [] Marker_All_TagBound_Copy;
5001 for (iMarker = 0; iMarker < geometry->
GetnMarker(); iMarker++)
5002 delete [] VertexIn[iMarker];
5006 delete [] Marker_All_TagBound;
5007 delete [] Buffer_Send_Marker_All_TagBound;
5009 delete [] nSendDomain_Periodic;
5010 delete [] nReceivedDomain_Periodic;
5011 delete [] nVertexDomain;
5012 delete [] nBoundLine;
5013 delete [] nBoundTriangle;
5014 delete [] nBoundQuadrilateral;
5015 delete [] Buffer_Send_nVertexDomain;
5016 delete [] Buffer_Send_nBoundLine;
5017 delete [] Buffer_Send_nBoundTriangle;
5018 delete [] Buffer_Send_nBoundQuadrilateral;
5019 delete [] Buffer_Send_Marker_All_SendRecv;
5022 delete [] send_stat;
5023 delete [] recv_stat;
5028 delete [] local_colour_values;
5044 Local_to_Global_Point = NULL;
5045 Local_to_Global_Marker = NULL;
5046 Global_to_Local_Marker = NULL;
5083 nLocal_PointDomain = 0;
5084 nLocal_PointGhost = 0;
5085 nLocal_PointPeriodic = 0;
5087 nLocal_BoundTria = 0;
5088 nLocal_BoundQuad = 0;
5096 Local_Coords = NULL;
5097 Local_Points = NULL;
5098 Local_Colors = NULL;
5103 Conn_BoundTria = NULL;
5104 Conn_BoundQuad = NULL;
5106 Conn_Line_Linear = NULL;
5107 Conn_BoundTria_Linear = NULL;
5108 Conn_BoundQuad_Linear = NULL;
5120 ID_BoundTria = NULL;
5121 ID_BoundQuad = NULL;
5122 ID_Line_Linear = NULL;
5123 ID_BoundTria_Linear = NULL;
5124 ID_BoundQuad_Linear = NULL;
5133 Elem_ID_Line = NULL;
5134 Elem_ID_BoundTria = NULL;
5135 Elem_ID_BoundQuad = NULL;
5136 Elem_ID_Line_Linear = NULL;
5137 Elem_ID_BoundTria_Linear = NULL;
5138 Elem_ID_BoundQuad_Linear = NULL;
5149 cout <<
"Distributing ParMETIS coloring." << endl;
5156 cout <<
"Rebalancing vertices." << endl;
5163 cout <<
"Rebalancing volume element connectivity." << endl;
5175 cout <<
"Rebalancing markers and surface elements." << endl;
5197 nLocal_Elem = (nLocal_Tria +
5203 nLocal_Bound_Elem = nLocal_Line + nLocal_BoundTria + nLocal_BoundQuad;
5205 nGlobal_Elem = nLocal_Elem;
5206 nGlobal_Bound_Elem = nLocal_Bound_Elem;
5227 if (Local_Points != NULL)
delete [] Local_Points;
5228 if (Local_Colors != NULL)
delete [] Local_Colors;
5229 if (Local_Coords != NULL)
delete [] Local_Coords;
5231 if (nLinear_Line > 0 && Conn_Line_Linear != NULL)
5232 delete [] Conn_Line_Linear;
5233 if (nLinear_BoundTria > 0 && Conn_BoundTria_Linear != NULL)
5234 delete [] Conn_BoundTria_Linear;
5235 if (nLinear_BoundQuad > 0 && Conn_BoundQuad_Linear != NULL)
5236 delete [] Conn_BoundQuad_Linear;
5238 if (nLocal_Line > 0 && Conn_Line != NULL)
delete [] Conn_Line;
5239 if (nLocal_BoundTria > 0 && Conn_BoundTria != NULL)
delete [] Conn_BoundTria;
5240 if (nLocal_BoundQuad > 0 && Conn_BoundQuad != NULL)
delete [] Conn_BoundQuad;
5241 if (nLocal_Tria > 0 && Conn_Tria != NULL)
delete [] Conn_Tria;
5242 if (nLocal_Quad > 0 && Conn_Quad != NULL)
delete [] Conn_Quad;
5243 if (nLocal_Tetr > 0 && Conn_Tetr != NULL)
delete [] Conn_Tetr;
5244 if (nLocal_Hexa > 0 && Conn_Hexa != NULL)
delete [] Conn_Hexa;
5245 if (nLocal_Pris > 0 && Conn_Pris != NULL)
delete [] Conn_Pris;
5246 if (nLocal_Pyra > 0 && Conn_Pyra != NULL)
delete [] Conn_Pyra;
5248 if (ID_Line != NULL)
delete [] ID_Line;
5249 if (ID_BoundTria != NULL)
delete [] ID_BoundTria;
5250 if (ID_BoundQuad != NULL)
delete [] ID_BoundQuad;
5251 if (ID_Line_Linear != NULL)
delete [] ID_Line_Linear;
5252 if (ID_BoundTria_Linear != NULL)
delete [] ID_BoundTria_Linear;
5253 if (ID_BoundQuad_Linear != NULL)
delete [] ID_BoundQuad_Linear;
5255 if (ID_Tria != NULL)
delete [] ID_Tria;
5256 if (ID_Quad != NULL)
delete [] ID_Quad;
5257 if (ID_Tetr != NULL)
delete [] ID_Tetr;
5258 if (ID_Hexa != NULL)
delete [] ID_Hexa;
5259 if (ID_Pris != NULL)
delete [] ID_Pris;
5260 if (ID_Pyra != NULL)
delete [] ID_Pyra;
5262 if (Elem_ID_Line != NULL)
delete [] Elem_ID_Line;
5263 if (Elem_ID_BoundTria != NULL)
delete [] Elem_ID_BoundTria;
5264 if (Elem_ID_BoundQuad != NULL)
delete [] Elem_ID_BoundQuad;
5265 if (Elem_ID_Line_Linear != NULL)
delete [] Elem_ID_Line_Linear;
5266 if (Elem_ID_BoundTria_Linear != NULL)
delete [] Elem_ID_BoundTria_Linear;
5267 if (Elem_ID_BoundQuad_Linear != NULL)
delete [] Elem_ID_BoundQuad_Linear;
5273 if (Local_to_Global_Point != NULL)
delete [] Local_to_Global_Point;
5274 if (Global_to_Local_Marker != NULL)
delete [] Global_to_Local_Marker;
5275 if (Local_to_Global_Marker != NULL)
delete [] Local_to_Global_Marker;
5279 unsigned short iMarker;
5281 for (iMarker = 0; iMarker <
nTurboPerf; iMarker++)
5286 for (iMarker = 0; iMarker <
nTurboPerf; iMarker++)
5291 for (iMarker = 0; iMarker <
nTurboPerf; iMarker++)
5296 for (iMarker = 0; iMarker <
nTurboPerf; iMarker++)
5301 for (iMarker = 0; iMarker <
nTurboPerf; iMarker++)
5306 for (iMarker = 0; iMarker <
nTurboPerf; iMarker++)
5316 unsigned short iSpan, iVertex;
5318 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
5322 for (iVertex = 0; iVertex <
nVertexSpan[iMarker][iSpan]; iVertex++)
5334 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
5344 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
5354 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
5365 for (iMarker = 0; iMarker <
nMarker; iMarker++)
5371 for (iMarker = 0; iMarker <
nMarker; iMarker++)
5377 for (iMarker = 0; iMarker <
nMarker; iMarker++)
5383 for (iMarker = 0; iMarker <
nMarker; iMarker++)
5389 for (iMarker = 0; iMarker <
nMarker; iMarker++)
5395 for (iMarker = 0; iMarker <
nMarker; iMarker++)
5404 for (iMarker = 0; iMarker < 2; iMarker++)
5410 for (iMarker = 0; iMarker <
nMarker; iMarker++)
5416 for (iMarker = 0; iMarker <
nMarker; iMarker++)
5432 unsigned short iNode, jNode;
5433 unsigned long iPoint, iNeighbor, jPoint, iElem, iProcessor;
5435 map<unsigned long, unsigned long> Point_Map;
5436 map<unsigned long, unsigned long>::iterator MI;
5438 vector<unsigned long>::iterator it;
5442 int iProc, iSend, iRecv, myStart, myFinal;
5448 for (iElem = 0; iElem < geometry->
GetnElem(); iElem++) {
5449 for (iNode = 0; iNode < geometry->
elem[iElem]->
GetnNodes(); iNode++) {
5451 Point_Map[iPoint] = iPoint;
5459 SU2_MPI::Error(
string(
"Mismatch between NPOIN and number of points")
5460 +
string(
" listed in mesh file.\n")
5461 +
string(
"Please check the mesh file for correctness.\n"),
5467 map<unsigned long, unsigned long> Global2Local;
5468 for (iPoint = 0; iPoint < geometry->
GetnPoint(); iPoint++) {
5475 for (MI = Point_Map.begin(); MI != Point_Map.end(); MI++) {
5479 Global2Local[Point_Map[iPoint]] = jPoint;
5487 Neighbors.resize(Point_Map.size());
5488 for (iElem = 0; iElem < geometry->
GetnElem(); iElem++) {
5489 for (iNode = 0; iNode < geometry->
elem[iElem]->
GetnNodes(); iNode++) {
5490 iPoint = Global2Local[geometry->
elem[iElem]->
GetNode(iNode)];
5491 for (jNode = 0; jNode < geometry->
elem[iElem]->
GetnNodes(); jNode++) {
5493 Neighbors[iPoint].push_back(jPoint);
5500 for (iPoint = 0; iPoint < Point_Map.size(); iPoint++) {
5501 sort(Neighbors[iPoint].begin(), Neighbors[iPoint].end());
5502 it = unique(Neighbors[iPoint].begin(), Neighbors[iPoint].end());
5503 Neighbors[iPoint].resize(it - Neighbors[iPoint].begin());
5508 int *nPoint_Send =
new int[
size+1]; nPoint_Send[0] = 0;
5509 int *nPoint_Recv =
new int[
size+1]; nPoint_Recv[0] = 0;
5510 int *nPoint_Flag =
new int[
size];
5512 for (iProc = 0; iProc <
size; iProc++) {
5513 nPoint_Send[iProc] = 0; nPoint_Recv[iProc] = 0; nPoint_Flag[iProc]= -1;
5515 nPoint_Send[
size] = 0; nPoint_Recv[
size] = 0;
5522 for (iPoint = 0; iPoint < geometry->
GetnPoint(); iPoint++) {
5523 for (iNeighbor = 0; iNeighbor < Neighbors[iPoint].size(); iNeighbor++) {
5527 jPoint = Neighbors[iPoint][iNeighbor];
5532 if (iProcessor >= (
unsigned long)
size)
5533 iProcessor = (
unsigned long)
size-1;
5535 while(jPoint >= geometry->
nPoint_Linear[iProcessor+1]) iProcessor++;
5537 while(jPoint < geometry->
nPoint_Linear[iProcessor]) iProcessor--;
5542 if (nPoint_Flag[iProcessor] != (
int)iPoint) {
5543 nPoint_Flag[iProcessor] = (int)iPoint;
5544 nPoint_Send[iProcessor+1]++;
5562 int nSends = 0, nRecvs = 0;
5563 for (iProc = 0; iProc <
size; iProc++) nPoint_Flag[iProc] = -1;
5565 for (iProc = 0; iProc <
size; iProc++) {
5566 if ((iProc !=
rank) && (nPoint_Send[iProc+1] > 0)) nSends++;
5567 if ((iProc !=
rank) && (nPoint_Recv[iProc+1] > 0)) nRecvs++;
5569 nPoint_Send[iProc+1] += nPoint_Send[iProc];
5570 nPoint_Recv[iProc+1] += nPoint_Recv[iProc];
5575 unsigned long *idSend =
new unsigned long[nPoint_Send[
size]];
5576 for (iSend = 0; iSend < nPoint_Send[
size]; iSend++) idSend[iSend] = 0;
5580 unsigned long *colorSend =
new unsigned long[nPoint_Send[
size]];
5581 for (iSend = 0; iSend < nPoint_Send[
size]; iSend++) colorSend[iSend] = 0;
5586 unsigned long *index =
new unsigned long[
size];
5587 for (iProc = 0; iProc <
size; iProc++) index[iProc] = nPoint_Send[iProc];
5591 for (iPoint = 0; iPoint < geometry->
GetnPoint(); iPoint++) {
5592 for (iNeighbor = 0; iNeighbor < Neighbors[iPoint].size(); iNeighbor++) {
5596 jPoint = Neighbors[iPoint][iNeighbor];
5601 if (iProcessor >= (
unsigned long)
size)
5602 iProcessor = (
unsigned long)
size-1;
5604 while(jPoint >= geometry->
nPoint_Linear[iProcessor+1]) iProcessor++;
5606 while(jPoint < geometry->
nPoint_Linear[iProcessor]) iProcessor--;
5611 if (nPoint_Flag[iProcessor] != (
int)iPoint) {
5613 nPoint_Flag[iProcessor] = (int)iPoint;
5614 unsigned long nn = index[iProcessor];
5623 index[iProcessor]++;
5638 unsigned long *colorRecv =
new unsigned long[nPoint_Recv[
size]];
5639 for (iRecv = 0; iRecv < nPoint_Recv[
size]; iRecv++)
5640 colorRecv[iRecv] = 0;
5642 unsigned long *idRecv =
new unsigned long[nPoint_Recv[
size]];
5643 for (iRecv = 0; iRecv < nPoint_Recv[
size]; iRecv++)
5660 colorRecv, nPoint_Recv, colorRecvReq,
5664 idRecv, nPoint_Recv, idRecvReq,
5669 iRecv = nPoint_Recv[
rank];
5670 myStart = nPoint_Send[
rank];
5671 myFinal = nPoint_Send[
rank+1];
5672 for (iSend = myStart; iSend < myFinal; iSend++) {
5673 colorRecv[iRecv] = colorSend[iSend];
5674 idRecv[iRecv] = idSend[iSend];
5689 for (iRecv = 0; iRecv < nPoint_Recv[
size]; iRecv++) {
5690 Color_List[idRecv[iRecv]] = colorRecv[iRecv];
5695 if (colorSendReq != NULL)
delete [] colorSendReq;
5696 if (idSendReq != NULL)
delete [] idSendReq;
5698 if (colorRecvReq != NULL)
delete [] colorRecvReq;
5699 if (idRecvReq != NULL)
delete [] idRecvReq;
5701 delete [] colorSend;
5702 delete [] colorRecv;
5705 delete [] nPoint_Recv;
5706 delete [] nPoint_Send;
5707 delete [] nPoint_Flag;
5713 unsigned short Elem_Type) {
5715 unsigned short NODES_PER_ELEMENT = 0;
5717 unsigned long iProcessor;
5718 unsigned long iElem, iNode, jNode, nElem_Total = 0, Global_Index;
5719 unsigned long *Conn_Elem = NULL;
5720 unsigned long *ID_Elems = NULL;
5724 int iProc, iSend, iRecv, myStart, myFinal;
5728 switch (Elem_Type) {
5748 NODES_PER_ELEMENT = 0;
5755 map<unsigned long, unsigned long> Local2GlobalElem;
5756 map<unsigned long, unsigned long>::iterator MI;
5760 Local2GlobalElem[MI->second] = MI->first;
5768 int *nElem_Send =
new int[
size+1]; nElem_Send[0] = 0;
5769 int *nElem_Recv =
new int[
size+1]; nElem_Recv[0] = 0;
5770 int *nElem_Flag =
new int[
size];
5772 for (iProc = 0; iProc <
size; iProc++) {
5773 nElem_Send[iProc] = 0; nElem_Recv[iProc] = 0; nElem_Flag[iProc]= -1;
5775 nElem_Send[
size] = 0; nElem_Recv[
size] = 0;
5777 for (iElem = 0; iElem < geometry->
GetnElem(); iElem++ ) {
5779 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++ ) {
5783 Global_Index = geometry->
elem[iElem]->
GetNode(iNode);
5787 iProcessor = Color_List[Global_Index];
5792 if ((nElem_Flag[iProcessor] != (
int)iElem)) {
5793 nElem_Flag[iProcessor] = (int)iElem;
5794 nElem_Send[iProcessor+1]++;
5813 int nSends = 0, nRecvs = 0;
5814 for (iProc = 0; iProc <
size; iProc++) nElem_Flag[iProc] = -1;
5816 for (iProc = 0; iProc <
size; iProc++) {
5817 if ((iProc !=
rank) && (nElem_Send[iProc+1] > 0)) nSends++;
5818 if ((iProc !=
rank) && (nElem_Recv[iProc+1] > 0)) nRecvs++;
5820 nElem_Send[iProc+1] += nElem_Send[iProc];
5821 nElem_Recv[iProc+1] += nElem_Recv[iProc];
5827 unsigned long *connSend = NULL;
5828 connSend =
new unsigned long[NODES_PER_ELEMENT*nElem_Send[
size]];
5829 for (iSend = 0; iSend < NODES_PER_ELEMENT*nElem_Send[
size]; iSend++)
5830 connSend[iSend] = 0;
5834 unsigned long *idSend =
new unsigned long[nElem_Send[
size]];
5835 for (iSend = 0; iSend < nElem_Send[
size]; iSend++) idSend[iSend] = 0;
5840 unsigned long *index =
new unsigned long[
size];
5841 for (iProc = 0; iProc <
size; iProc++)
5842 index[iProc] = NODES_PER_ELEMENT*nElem_Send[iProc];
5844 unsigned long *idIndex =
new unsigned long[
size];
5845 for (iProc = 0; iProc <
size; iProc++)
5846 idIndex[iProc] = nElem_Send[iProc];
5851 for (iElem = 0; iElem < geometry->
GetnElem(); iElem++) {
5853 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++ ) {
5857 Global_Index = geometry->
elem[iElem]->
GetNode(iNode);
5861 iProcessor = Color_List[Global_Index];
5865 if (nElem_Flag[iProcessor] != (
int)iElem) {
5867 nElem_Flag[iProcessor] = (int)iElem;
5868 unsigned long nn = index[iProcessor];
5869 unsigned long mm = idIndex[iProcessor];
5874 for (jNode = 0; jNode < NODES_PER_ELEMENT; jNode++) {
5875 connSend[nn] = geometry->
elem[iElem]->
GetNode(jNode); nn++;
5880 idSend[mm] = Local2GlobalElem[iElem];
5884 index[iProcessor] += NODES_PER_ELEMENT;
5885 idIndex[iProcessor]++;
5902 unsigned long *connRecv = NULL;
5903 connRecv =
new unsigned long[NODES_PER_ELEMENT*nElem_Recv[
size]];
5904 for (iRecv = 0; iRecv < NODES_PER_ELEMENT*nElem_Recv[
size]; iRecv++)
5905 connRecv[iRecv] = 0;
5907 unsigned long *idRecv =
new unsigned long[nElem_Recv[
size]];
5908 for (iRecv = 0; iRecv < nElem_Recv[
size]; iRecv++) idRecv[iRecv] = 0;
5924 connRecv, nElem_Recv, connRecvReq,
5928 idRecv, nElem_Recv, idRecvReq,
5933 iRecv = NODES_PER_ELEMENT*nElem_Recv[
rank];
5934 myStart = NODES_PER_ELEMENT*nElem_Send[
rank];
5935 myFinal = NODES_PER_ELEMENT*nElem_Send[
rank+1];
5936 for (iSend = myStart; iSend < myFinal; iSend++) {
5937 connRecv[iRecv] = connSend[iSend];
5941 iRecv = nElem_Recv[
rank];
5942 myStart = nElem_Send[
rank];
5943 myFinal = nElem_Send[
rank+1];
5944 for (iSend = myStart; iSend < myFinal; iSend++) {
5945 idRecv[iRecv] = idSend[iSend];
5957 if (nElem_Recv[
size] > 0) {
5958 Conn_Elem =
new unsigned long[NODES_PER_ELEMENT*nElem_Recv[
size]];
5959 int count = 0; nElem_Total = 0;
5960 for (iRecv = 0; iRecv < nElem_Recv[
size]; iRecv++) {
5962 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
5963 Conn_Elem[count] = connRecv[iRecv*NODES_PER_ELEMENT+iNode];
5971 if (nElem_Recv[
size] > 0) {
5972 ID_Elems =
new unsigned long[nElem_Recv[
size]];
5973 for (iRecv = 0; iRecv < nElem_Recv[
size]; iRecv++) {
5974 ID_Elems[iRecv] = idRecv[iRecv];
5981 switch (Elem_Type) {
5983 nLocal_Tria = nElem_Total;
5984 if (nLocal_Tria > 0) {
5985 Conn_Tria = Conn_Elem;
5990 nLocal_Quad = nElem_Total;
5991 if (nLocal_Quad > 0) {
5992 Conn_Quad = Conn_Elem;
5997 nLocal_Tetr = nElem_Total;
5998 if (nLocal_Tetr > 0) {
5999 Conn_Tetr = Conn_Elem;
6004 nLocal_Hexa = nElem_Total;
6005 if (nLocal_Hexa > 0) {
6006 Conn_Hexa = Conn_Elem;
6011 nLocal_Pris = nElem_Total;
6012 if (nLocal_Pris > 0) {
6013 Conn_Pris = Conn_Elem;
6018 nLocal_Pyra = nElem_Total;
6019 if (nLocal_Pyra > 0) {
6020 Conn_Pyra = Conn_Elem;
6031 Local2GlobalElem.clear();
6033 if (connSendReq != NULL)
delete [] connSendReq;
6034 if (idSendReq != NULL)
delete [] idSendReq;
6036 if (connRecvReq != NULL)
delete [] connRecvReq;
6037 if (idRecvReq != NULL)
delete [] idRecvReq;
6043 delete [] nElem_Recv;
6044 delete [] nElem_Send;
6045 delete [] nElem_Flag;
6056 unsigned short iDim;
6057 unsigned long iPoint, iNeighbor, jPoint, iProcessor;
6058 vector<unsigned long>::iterator it;
6060 SU2_MPI::Request *colorSendReq = NULL, *idSendReq = NULL, *coordSendReq = NULL;
6061 SU2_MPI::Request *colorRecvReq = NULL, *idRecvReq = NULL, *coordRecvReq = NULL;
6062 int iProc, iSend, iRecv, myStart, myFinal;
6066 int *nPoint_Send =
new int[
size+1]; nPoint_Send[0] = 0;
6067 int *nPoint_Recv =
new int[
size+1]; nPoint_Recv[0] = 0;
6068 int *nPoint_Flag =
new int[
size];
6070 for (iProc = 0; iProc <
size; iProc++) {
6071 nPoint_Send[iProc] = 0; nPoint_Recv[iProc] = 0; nPoint_Flag[iProc]= -1;
6073 nPoint_Send[
size] = 0; nPoint_Recv[
size] = 0;
6080 for (iPoint = 0; iPoint < geometry->
GetnPoint(); iPoint++) {
6081 for (iNeighbor = 0; iNeighbor < Neighbors[iPoint].size(); iNeighbor++) {
6085 jPoint = Neighbors[iPoint][iNeighbor];
6089 iProcessor = Color_List[jPoint];
6094 if (nPoint_Flag[iProcessor] != (
int)iPoint) {
6095 nPoint_Flag[iProcessor] = (int)iPoint;
6096 nPoint_Send[iProcessor+1]++;
6113 int nSends = 0, nRecvs = 0;
6114 for (iProc = 0; iProc <
size; iProc++) nPoint_Flag[iProc] = -1;
6116 for (iProc = 0; iProc <
size; iProc++) {
6117 if ((iProc !=
rank) && (nPoint_Send[iProc+1] > 0)) nSends++;
6118 if ((iProc !=
rank) && (nPoint_Recv[iProc+1] > 0)) nRecvs++;
6120 nPoint_Send[iProc+1] += nPoint_Send[iProc];
6121 nPoint_Recv[iProc+1] += nPoint_Recv[iProc];
6126 unsigned long *idSend =
new unsigned long[nPoint_Send[
size]];
6127 for (iSend = 0; iSend < nPoint_Send[
size]; iSend++) idSend[iSend] = 0;
6131 unsigned long *colorSend =
new unsigned long[nPoint_Send[
size]];
6132 for (iSend = 0; iSend < nPoint_Send[
size]; iSend++) colorSend[iSend] = 0;
6138 for (iSend = 0; iSend <
nDim*nPoint_Send[
size]; iSend++)
6139 coordSend[iSend] = 0;
6144 unsigned long *index =
new unsigned long[
size];
6145 for (iProc = 0; iProc <
size; iProc++)
6146 index[iProc] = nPoint_Send[iProc];
6148 unsigned long *coordIndex =
new unsigned long[
size];
6149 for (iProc = 0; iProc <
size; iProc++)
6150 coordIndex[iProc] =
nDim*nPoint_Send[iProc];
6154 for (iPoint = 0; iPoint < geometry->
GetnPoint(); iPoint++) {
6155 for (iNeighbor = 0; iNeighbor < Neighbors[iPoint].size(); iNeighbor++) {
6159 jPoint = Neighbors[iPoint][iNeighbor];
6163 iProcessor = Color_List[jPoint];
6168 if (nPoint_Flag[iProcessor] != (
int)iPoint) {
6170 nPoint_Flag[iProcessor] = (int)iPoint;
6171 unsigned long nn = index[iProcessor];
6178 nn = coordIndex[iProcessor];
6179 for (iDim = 0; iDim <
nDim; iDim++) {
6180 coordSend[nn] = geometry->
node[iPoint]->
GetCoord(iDim); nn++;
6185 coordIndex[iProcessor] +=
nDim;
6186 index[iProcessor]++;
6195 delete [] coordIndex;
6202 unsigned long *colorRecv =
new unsigned long[nPoint_Recv[
size]];
6203 for (iRecv = 0; iRecv < nPoint_Recv[
size]; iRecv++)
6204 colorRecv[iRecv] = 0;
6206 unsigned long *idRecv =
new unsigned long[nPoint_Recv[
size]];
6207 for (iRecv = 0; iRecv < nPoint_Recv[
size]; iRecv++)
6212 for (iRecv = 0; iRecv <
nDim*nPoint_Recv[
size]; iRecv++)
6213 coordRecv[iRecv] = 0;
6232 colorRecv, nPoint_Recv, colorRecvReq,
6236 idRecv, nPoint_Recv, idRecvReq,
6240 coordRecv, nPoint_Recv, coordRecvReq,
6245 iRecv = nPoint_Recv[
rank];
6246 myStart = nPoint_Send[
rank];
6247 myFinal = nPoint_Send[
rank+1];
6248 for (iSend = myStart; iSend < myFinal; iSend++) {
6249 colorRecv[iRecv] = colorSend[iSend];
6250 idRecv[iRecv] = idSend[iSend];
6256 myFinal =
nDim*nPoint_Send[
rank+1];
6257 for (iSend = myStart; iSend < myFinal; iSend++) {
6258 coordRecv[iRecv] = coordSend[iSend];
6271 nLocal_Point = nPoint_Recv[
size];
6276 Local_Points =
new unsigned long[nPoint_Recv[
size]];
6277 Local_Colors =
new unsigned long[nPoint_Recv[
size]];
6280 nLocal_PointDomain = 0; nLocal_PointGhost = 0;
6281 for (iRecv = 0; iRecv < nPoint_Recv[
size]; iRecv++) {
6282 Local_Points[iRecv] = idRecv[iRecv];
6283 Local_Colors[iRecv] = colorRecv[iRecv];
6284 for (iDim = 0; iDim <
nDim; iDim++)
6285 Local_Coords[iRecv*
nDim+iDim] = coordRecv[iRecv*
nDim+iDim];
6286 if (Local_Colors[iRecv] == (
unsigned long)
rank) nLocal_PointDomain++;
6287 else nLocal_PointGhost++;
6292 if (colorSendReq != NULL)
delete [] colorSendReq;
6293 if (idSendReq != NULL)
delete [] idSendReq;
6294 if (coordSendReq != NULL)
delete [] coordSendReq;
6296 if (colorRecvReq != NULL)
delete [] colorRecvReq;
6297 if (idRecvReq != NULL)
delete [] idRecvReq;
6298 if (coordRecvReq != NULL)
delete [] coordRecvReq;
6300 delete [] colorSend;
6301 delete [] colorRecv;
6304 delete [] coordSend;
6305 delete [] coordRecv;
6306 delete [] nPoint_Recv;
6307 delete [] nPoint_Send;
6308 delete [] nPoint_Flag;
6314 unsigned short Elem_Type) {
6327 unsigned short NODES_PER_ELEMENT = 0;
6329 unsigned long iMarker, iProcessor, iElem, iNode, jNode;
6330 unsigned long nElem_Total = 0, Global_Index, Global_Elem_Index;
6332 unsigned long *Conn_Elem = NULL;
6333 unsigned long *Linear_Markers = NULL;
6334 unsigned long *ID_SurfElem = NULL;
6336 SU2_MPI::Request *connSendReq = NULL, *markerSendReq = NULL, *idSendReq = NULL;
6337 SU2_MPI::Request *connRecvReq = NULL, *markerRecvReq = NULL, *idRecvReq = NULL;
6338 int iProc, iSend, iRecv, myStart, myFinal;
6345 switch (Elem_Type) {
6360 int *nElem_Send =
new int[
size+1]; nElem_Send[0] = 0;
6361 int *nElem_Recv =
new int[
size+1]; nElem_Recv[0] = 0;
6362 int *nElem_Flag =
new int[
size];
6364 for (iProc = 0; iProc <
size; iProc++) {
6365 nElem_Send[iProc] = 0; nElem_Recv[iProc] = 0; nElem_Flag[iProc]= -1;
6367 nElem_Send[
size] = 0; nElem_Recv[
size] = 0;
6373 for (iMarker = 0; iMarker < geometry->
GetnMarker(); iMarker++) {
6379 for (iProc = 0; iProc <
size; iProc++) nElem_Flag[iProc]= -1;
6381 for (iElem = 0; iElem < geometry->
GetnElem_Bound(iMarker); iElem++) {
6385 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++ ) {
6389 Global_Index = geometry->
bound[iMarker][iElem]->
GetNode(iNode);
6394 if (iProcessor >= (
unsigned long)
size)
6395 iProcessor = (
unsigned long)
size-1;
6397 while(Global_Index >= geometry->
nPoint_Linear[iProcessor+1])
6406 if ((nElem_Flag[iProcessor] != (
int)iElem)) {
6407 nElem_Flag[iProcessor] = (int)iElem;
6408 nElem_Send[iProcessor+1]++;
6428 int nSends = 0, nRecvs = 0;
6429 for (iProc = 0; iProc <
size; iProc++) nElem_Flag[iProc] = -1;
6431 for (iProc = 0; iProc <
size; iProc++) {
6432 if ((iProc !=
rank) && (nElem_Send[iProc+1] > 0)) nSends++;
6433 if ((iProc !=
rank) && (nElem_Recv[iProc+1] > 0)) nRecvs++;
6435 nElem_Send[iProc+1] += nElem_Send[iProc];
6436 nElem_Recv[iProc+1] += nElem_Recv[iProc];
6441 unsigned long *connSend = NULL;
6442 unsigned long *markerSend = NULL;
6443 unsigned long *idSend = NULL;
6447 connSend =
new unsigned long[NODES_PER_ELEMENT*nElem_Send[
size]];
6448 for (iSend = 0; iSend < NODES_PER_ELEMENT*nElem_Send[
size]; iSend++)
6449 connSend[iSend] = 0;
6451 markerSend =
new unsigned long[nElem_Send[
size]];
6452 for (iSend = 0; iSend < nElem_Send[
size]; iSend++)
6453 markerSend[iSend] = 0;
6455 idSend =
new unsigned long[nElem_Send[
size]];
6456 for (iSend = 0; iSend < nElem_Send[
size]; iSend++)
6462 unsigned long *index =
new unsigned long[
size];
6463 for (iProc = 0; iProc <
size; iProc++)
6464 index[iProc] = NODES_PER_ELEMENT*nElem_Send[iProc];
6466 unsigned long *markerIndex =
new unsigned long[
size];
6467 for (iProc = 0; iProc <
size; iProc++)
6468 markerIndex[iProc] = nElem_Send[iProc];
6473 Global_Elem_Index = 0;
6474 for (iMarker = 0; iMarker < geometry->
GetnMarker(); iMarker++) {
6480 for (iProc = 0; iProc <
size; iProc++) nElem_Flag[iProc]= -1;
6482 for (iElem = 0; iElem < geometry->
GetnElem_Bound(iMarker); iElem++) {
6484 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++ ) {
6488 Global_Index = geometry->
bound[iMarker][iElem]->
GetNode(iNode);
6493 if (iProcessor >= (
unsigned long)
size)
6494 iProcessor = (
unsigned long)
size-1;
6496 while(Global_Index >= geometry->
nPoint_Linear[iProcessor+1])
6504 if ((nElem_Flag[iProcessor] != (
int)iElem)) {
6506 nElem_Flag[iProcessor] = (int)iElem;
6507 unsigned long nn = index[iProcessor];
6508 unsigned long mm = markerIndex[iProcessor];
6512 for (jNode = 0; jNode < NODES_PER_ELEMENT; jNode++) {
6513 connSend[nn] = geometry->
bound[iMarker][iElem]->
GetNode(jNode);
6519 markerSend[mm] = iMarker;
6520 idSend[mm] = Global_Elem_Index;
6524 index[iProcessor] += NODES_PER_ELEMENT;
6525 markerIndex[iProcessor]++;
6531 Global_Elem_Index++;
6539 delete [] markerIndex;
6548 unsigned long *connRecv = NULL;
6549 connRecv =
new unsigned long[NODES_PER_ELEMENT*nElem_Recv[
size]];
6550 for (iRecv = 0; iRecv < NODES_PER_ELEMENT*nElem_Recv[
size]; iRecv++)
6551 connRecv[iRecv] = 0;
6553 unsigned long *markerRecv =
new unsigned long[nElem_Recv[
size]];
6554 for (iRecv = 0; iRecv < nElem_Recv[
size]; iRecv++)
6555 markerRecv[iRecv] = 0;
6557 unsigned long *idRecv =
new unsigned long[nElem_Recv[
size]];
6558 for (iRecv = 0; iRecv < nElem_Recv[
size]; iRecv++)
6577 connRecv, nElem_Recv, connRecvReq,
6581 markerRecv, nElem_Recv, markerRecvReq,
6585 idRecv, nElem_Recv, idRecvReq,
6592 iRecv = NODES_PER_ELEMENT*nElem_Recv[
rank];
6593 myStart = NODES_PER_ELEMENT*nElem_Send[
rank];
6594 myFinal = NODES_PER_ELEMENT*nElem_Send[
rank+1];
6595 for (iSend = myStart; iSend < myFinal; iSend++) {
6596 connRecv[iRecv] = connSend[iSend];
6600 iRecv = nElem_Recv[
rank];
6601 myStart = nElem_Send[
rank];
6602 myFinal = nElem_Send[
rank+1];
6603 for (iSend = myStart; iSend < myFinal; iSend++) {
6604 markerRecv[iRecv] = markerSend[iSend];
6605 idRecv[iRecv] = idSend[iSend];
6614 CompleteComms(nSends, markerSendReq, nRecvs, markerRecvReq);
6621 if (nElem_Recv[
size] > 0) {
6622 Conn_Elem =
new unsigned long[NODES_PER_ELEMENT*nElem_Recv[
size]];
6623 int count = 0; nElem_Total = 0;
6624 for (iRecv = 0; iRecv < nElem_Recv[
size]; iRecv++) {
6626 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
6627 Conn_Elem[count] = connRecv[iRecv*NODES_PER_ELEMENT+iNode];
6635 if (nElem_Recv[
size] > 0) {
6636 Linear_Markers =
new unsigned long[nElem_Recv[
size]];
6637 for (iRecv = 0; iRecv < nElem_Recv[
size]; iRecv++) {
6638 Linear_Markers[iRecv] = markerRecv[iRecv];
6644 if (nElem_Recv[
size] > 0) {
6645 ID_SurfElem =
new unsigned long[nElem_Recv[
size]];
6646 for (iRecv = 0; iRecv < nElem_Recv[
size]; iRecv++) {
6647 ID_SurfElem[iRecv] = idRecv[iRecv];
6654 switch (Elem_Type) {
6656 nLinear_Line = nElem_Total;
6657 if (nLinear_Line > 0) {
6658 Conn_Line_Linear = Conn_Elem;
6659 ID_Line_Linear = Linear_Markers;
6660 Elem_ID_Line_Linear = ID_SurfElem;
6664 nLinear_BoundTria = nElem_Total;
6665 if (nLinear_BoundTria > 0) {
6666 Conn_BoundTria_Linear = Conn_Elem;
6667 ID_BoundTria_Linear = Linear_Markers;
6668 Elem_ID_BoundTria_Linear = ID_SurfElem;
6672 nLinear_BoundQuad = nElem_Total;
6673 if (nLinear_BoundQuad > 0) {
6674 Conn_BoundQuad_Linear = Conn_Elem;
6675 ID_BoundQuad_Linear = Linear_Markers;
6676 Elem_ID_BoundQuad_Linear = ID_SurfElem;
6686 if (connSendReq != NULL)
delete [] connSendReq;
6687 if (markerSendReq != NULL)
delete [] markerSendReq;
6688 if (idSendReq != NULL)
delete [] idSendReq;
6690 if (connRecvReq != NULL)
delete [] connRecvReq;
6691 if (markerRecvReq != NULL)
delete [] markerRecvReq;
6692 if (idRecvReq != NULL)
delete [] idRecvReq;
6694 if (connSend != NULL)
delete [] connSend;
6695 if (markerSend != NULL)
delete [] markerSend;
6696 if (idSend != NULL)
delete [] idSend;
6699 delete [] markerRecv;
6702 delete [] nElem_Recv;
6703 delete [] nElem_Send;
6704 delete [] nElem_Flag;
6710 unsigned short Elem_Type) {
6712 unsigned short NODES_PER_ELEMENT = 0;
6714 unsigned long iProcessor, NELEM = 0;
6715 unsigned long iElem, iNode, jNode, nElem_Total = 0, Global_Index;
6717 unsigned long *Conn_Linear = NULL;
6718 unsigned long *Conn_Elem = NULL;
6719 unsigned long *Linear_Markers = NULL;
6720 unsigned long *ID_SurfElem_Linear = NULL;
6721 unsigned long *Local_Markers = NULL;
6722 unsigned long *ID_SurfElem = NULL;
6724 SU2_MPI::Request *connSendReq = NULL,*markerSendReq = NULL,*idSendReq = NULL;
6725 SU2_MPI::Request *connRecvReq = NULL,*markerRecvReq = NULL,*idRecvReq = NULL;
6726 int iProc, iSend, iRecv, myStart, myFinal;
6733 switch (Elem_Type) {
6735 NELEM = nLinear_Line;
6737 Conn_Linear = Conn_Line_Linear;
6738 Linear_Markers = ID_Line_Linear;
6739 ID_SurfElem_Linear = Elem_ID_Line_Linear;
6742 NELEM = nLinear_BoundTria;
6744 Conn_Linear = Conn_BoundTria_Linear;
6745 Linear_Markers = ID_BoundTria_Linear;
6746 ID_SurfElem_Linear = Elem_ID_BoundTria_Linear;
6749 NELEM = nLinear_BoundQuad;
6751 Conn_Linear = Conn_BoundQuad_Linear;
6752 Linear_Markers = ID_BoundQuad_Linear;
6753 ID_SurfElem_Linear = Elem_ID_BoundQuad_Linear;
6765 int *nElem_Send =
new int[
size+1]; nElem_Send[0] = 0;
6766 int *nElem_Recv =
new int[
size+1]; nElem_Recv[0] = 0;
6767 int *nElem_Flag =
new int[
size];
6769 for (iProc = 0; iProc <
size; iProc++) {
6770 nElem_Send[iProc] = 0; nElem_Recv[iProc] = 0; nElem_Flag[iProc]= -1;
6772 nElem_Send[
size] = 0; nElem_Recv[
size] = 0;
6774 for (iElem = 0; iElem < NELEM; iElem++) {
6775 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
6779 Global_Index = Conn_Linear[iElem*NODES_PER_ELEMENT+iNode];
6783 iProcessor = Color_List[Global_Index];
6788 if ((nElem_Flag[iProcessor] != (
int)iElem)) {
6789 nElem_Flag[iProcessor] = (int)iElem;
6790 nElem_Send[iProcessor+1]++;
6808 int nSends = 0, nRecvs = 0;
6809 for (iProc = 0; iProc <
size; iProc++) nElem_Flag[iProc] = -1;
6811 for (iProc = 0; iProc <
size; iProc++) {
6812 if ((iProc !=
rank) && (nElem_Send[iProc+1] > 0)) nSends++;
6813 if ((iProc !=
rank) && (nElem_Recv[iProc+1] > 0)) nRecvs++;
6815 nElem_Send[iProc+1] += nElem_Send[iProc];
6816 nElem_Recv[iProc+1] += nElem_Recv[iProc];
6822 unsigned long *connSend = NULL;
6823 connSend =
new unsigned long[NODES_PER_ELEMENT*nElem_Send[
size]];
6824 for (iSend = 0; iSend < NODES_PER_ELEMENT*nElem_Send[
size]; iSend++)
6825 connSend[iSend] = 0;
6829 unsigned long *markerSend =
new unsigned long[nElem_Send[
size]];
6830 for (iSend = 0; iSend < nElem_Send[
size]; iSend++) markerSend[iSend] = 0;
6832 unsigned long *idSend =
new unsigned long[nElem_Send[
size]];
6833 for (iSend = 0; iSend < nElem_Send[
size]; iSend++) idSend[iSend] = 0;
6838 unsigned long *index =
new unsigned long[
size];
6839 for (iProc = 0; iProc <
size; iProc++)
6840 index[iProc] = NODES_PER_ELEMENT*nElem_Send[iProc];
6842 unsigned long *markerIndex =
new unsigned long[
size];
6843 for (iProc = 0; iProc <
size; iProc++)
6844 markerIndex[iProc] = nElem_Send[iProc];
6849 for (iElem = 0; iElem < NELEM; iElem++) {
6850 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
6854 Global_Index = Conn_Linear[iElem*NODES_PER_ELEMENT+iNode];
6858 iProcessor = Color_List[Global_Index];
6863 if (nElem_Flag[iProcessor] != (
int)iElem) {
6865 nElem_Flag[iProcessor] = (int)iElem;
6866 unsigned long nn = index[iProcessor];
6867 unsigned long mm = markerIndex[iProcessor];
6871 for (jNode = 0; jNode < NODES_PER_ELEMENT; jNode++) {
6876 connSend[nn] = Conn_Linear[iElem*NODES_PER_ELEMENT+jNode]; nn++;
6882 markerSend[mm] = Linear_Markers[iElem];
6883 idSend[mm] = ID_SurfElem_Linear[iElem];
6887 index[iProcessor] += NODES_PER_ELEMENT;
6888 markerIndex[iProcessor]++;
6897 delete [] markerIndex;
6904 unsigned long *connRecv = NULL;
6905 connRecv =
new unsigned long[NODES_PER_ELEMENT*nElem_Recv[
size]];
6906 for (iRecv = 0; iRecv < NODES_PER_ELEMENT*nElem_Recv[
size]; iRecv++)
6907 connRecv[iRecv] = 0;
6909 unsigned long *markerRecv =
new unsigned long[nElem_Recv[
size]];
6910 for (iRecv = 0; iRecv < nElem_Recv[
size]; iRecv++) markerRecv[iRecv] = 0;
6912 unsigned long *idRecv =
new unsigned long[nElem_Recv[
size]];
6913 for (iRecv = 0; iRecv < nElem_Recv[
size]; iRecv++) idRecv[iRecv] = 0;
6931 connRecv, nElem_Recv, connRecvReq,
6935 markerRecv, nElem_Recv, markerRecvReq,
6939 idRecv, nElem_Recv, idRecvReq,
6944 iRecv = NODES_PER_ELEMENT*nElem_Recv[
rank];
6945 myStart = NODES_PER_ELEMENT*nElem_Send[
rank];
6946 myFinal = NODES_PER_ELEMENT*nElem_Send[
rank+1];
6947 for (iSend = myStart; iSend < myFinal; iSend++) {
6948 connRecv[iRecv] = connSend[iSend];
6952 iRecv = nElem_Recv[
rank];
6953 myStart = nElem_Send[
rank];
6954 myFinal = nElem_Send[
rank+1];
6955 for (iSend = myStart; iSend < myFinal; iSend++) {
6956 markerRecv[iRecv] = markerSend[iSend];
6957 idRecv[iRecv] = idSend[iSend];
6964 CompleteComms(nSends, markerSendReq, nRecvs, markerRecvReq);
6970 if (nElem_Recv[
size] > 0) {
6971 Conn_Elem =
new unsigned long[NODES_PER_ELEMENT*nElem_Recv[
size]];
6972 int count = 0; nElem_Total = 0;
6973 for (iRecv = 0; iRecv < nElem_Recv[
size]; iRecv++) {
6975 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
6976 Conn_Elem[count] = connRecv[iRecv*NODES_PER_ELEMENT+iNode];
6984 if (nElem_Recv[
size] > 0) {
6985 Local_Markers =
new unsigned long[nElem_Recv[
size]];
6986 for (iRecv = 0; iRecv < nElem_Recv[
size]; iRecv++) {
6987 Local_Markers[iRecv] = markerRecv[iRecv];
6993 if (nElem_Recv[
size] > 0) {
6994 ID_SurfElem =
new unsigned long[nElem_Recv[
size]];
6995 for (iRecv = 0; iRecv < nElem_Recv[
size]; iRecv++) {
6996 ID_SurfElem[iRecv] = idRecv[iRecv];
7003 switch (Elem_Type) {
7005 nLocal_Line = nElem_Total;
7006 if (nLocal_Line > 0) {
7007 Conn_Line = Conn_Elem;
7008 ID_Line = Local_Markers;
7009 Elem_ID_Line = ID_SurfElem;
7013 nLocal_BoundTria = nElem_Total;
7014 if (nLocal_BoundTria > 0) {
7015 Conn_BoundTria = Conn_Elem;
7016 ID_BoundTria = Local_Markers;
7017 Elem_ID_BoundTria = ID_SurfElem;
7021 nLocal_BoundQuad = nElem_Total;
7022 if (nLocal_BoundQuad > 0) {
7023 Conn_BoundQuad = Conn_Elem;
7024 ID_BoundQuad = Local_Markers;
7025 Elem_ID_BoundQuad = ID_SurfElem;
7035 if (connSendReq != NULL)
delete [] connSendReq;
7036 if (markerSendReq != NULL)
delete [] markerSendReq;
7037 if (idSendReq != NULL)
delete [] idSendReq;
7039 if (connRecvReq != NULL)
delete [] connRecvReq;
7040 if (markerRecvReq != NULL)
delete [] markerRecvReq;
7041 if (idRecvReq != NULL)
delete [] idRecvReq;
7045 delete [] markerSend;
7046 delete [] markerRecv;
7049 delete [] nElem_Recv;
7050 delete [] nElem_Send;
7051 delete [] nElem_Flag;
7057 unsigned long iMarker, index, iChar;
7075 for (iMarker = 0; iMarker < nMarker_Global; iMarker++) {
7089 for (iMarker = 0; iMarker < nMarker_Global; iMarker++) {
7092 str_buf[iChar] = mpi_str_buf[index + iChar];
7094 Marker_Tags.push_back(str_buf);
7101 delete [] mpi_str_buf;
7107 unsigned long iPoint, jPoint, iOwned, iPeriodic, iGhost;
7117 Local_to_Global_Point =
new long[
nPoint];
7121 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
7122 Local_to_Global_Point[iPoint] = -1;
7130 iPeriodic = nLocal_PointDomain;
7131 iGhost = nLocal_PointDomain + nLocal_PointPeriodic;
7136 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
7140 if (Local_Colors[iPoint] == (
unsigned long)
rank) {
7143 else jPoint = iPeriodic;
7150 Local_to_Global_Point[jPoint] = Local_Points[iPoint];
7156 Local_Coords[iPoint*
nDim+1],
7157 Local_to_Global_Point[jPoint], config);
7160 Local_Coords[iPoint*
nDim+1],
7161 Local_Coords[iPoint*
nDim+2],
7162 Local_to_Global_Point[jPoint], config);
7170 if (Local_Colors[iPoint] == (
unsigned long)
rank) {
7182 for (iPoint = 0; iPoint <
nPoint; iPoint++)
7183 Global_to_Local_Point[Local_to_Global_Point[iPoint]] = iPoint;
7187 unsigned long Local_nPoint =
nPoint;
7201 cout <<
Global_nPoint <<
" vertices including ghost points. " << endl;
7207 unsigned short NODES_PER_ELEMENT;
7209 unsigned long iElem, jElem, kElem, iNode, Local_Elem, iGlobal_Index;
7212 unsigned long iElemTria = 0;
7213 unsigned long iElemQuad = 0;
7214 unsigned long iElemTetr = 0;
7215 unsigned long iElemHexa = 0;
7216 unsigned long iElemPris = 0;
7217 unsigned long iElemPyra = 0;
7219 unsigned long nTria, nQuad, nTetr, nHexa, nPris, nPyra;
7221 map<unsigned long, unsigned long> Tria_List;
7222 map<unsigned long, unsigned long> Quad_List;
7223 map<unsigned long, unsigned long> Tetr_List;
7224 map<unsigned long, unsigned long> Hexa_List;
7225 map<unsigned long, unsigned long> Pris_List;
7226 map<unsigned long, unsigned long> Pyra_List;
7227 map<unsigned long, unsigned long>::iterator it;
7235 for (iElem=0; iElem < nLocal_Tria; iElem++) {
7236 Tria_List[ID_Tria[iElem]] = iElem;
7238 nTria = Tria_List.size();
7241 for (iElem=0; iElem < nLocal_Quad; iElem++) {
7242 Quad_List[ID_Quad[iElem]] = iElem;
7244 nQuad = Quad_List.size();
7247 for (iElem=0; iElem < nLocal_Tetr; iElem++) {
7248 Tetr_List[ID_Tetr[iElem]] = iElem;
7250 nTetr = Tetr_List.size();
7253 for (iElem=0; iElem < nLocal_Hexa; iElem++) {
7254 Hexa_List[ID_Hexa[iElem]] = iElem;
7256 nHexa = Hexa_List.size();
7259 for (iElem=0; iElem < nLocal_Pris; iElem++) {
7260 Pris_List[ID_Pris[iElem]] = iElem;
7262 nPris = Pris_List.size();
7265 for (iElem=0; iElem < nLocal_Pyra; iElem++) {
7266 Pyra_List[ID_Pyra[iElem]] = iElem;
7268 nPyra = Pyra_List.size();
7272 Local_Elem = nTria + nQuad + nTetr + nHexa + nPris + nPyra;
7282 for (it = Tria_List.begin(); it != Tria_List.end(); it++) {
7291 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
7292 iGlobal_Index = Conn_Tria[iElem*NODES_PER_ELEMENT+iNode];
7293 Local_Nodes[iNode] = Global_to_Local_Point[iGlobal_Index];
7306 jElem++; iElemTria++;
7314 for (it = Quad_List.begin(); it != Quad_List.end(); it++) {
7323 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
7324 iGlobal_Index = Conn_Quad[iElem*NODES_PER_ELEMENT+iNode];
7325 Local_Nodes[iNode] = Global_to_Local_Point[iGlobal_Index];
7339 jElem++; iElemQuad++;
7347 for (it = Tetr_List.begin(); it != Tetr_List.end(); it++) {
7356 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
7357 iGlobal_Index = Conn_Tetr[iElem*NODES_PER_ELEMENT+iNode];
7358 Local_Nodes[iNode] = Global_to_Local_Point[iGlobal_Index];
7372 jElem++; iElemTetr++;
7380 for (it = Hexa_List.begin(); it != Hexa_List.end(); it++) {
7389 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
7390 iGlobal_Index = Conn_Hexa[iElem*NODES_PER_ELEMENT+iNode];
7391 Local_Nodes[iNode] = Global_to_Local_Point[iGlobal_Index];
7409 jElem++; iElemHexa++;
7417 for (it = Pris_List.begin(); it != Pris_List.end(); it++) {
7426 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
7427 iGlobal_Index = Conn_Pris[iElem*NODES_PER_ELEMENT+iNode];
7428 Local_Nodes[iNode] = Global_to_Local_Point[iGlobal_Index];
7444 jElem++; iElemPris++;
7452 for (it = Pyra_List.begin(); it != Pyra_List.end(); it++) {
7461 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
7462 iGlobal_Index = Conn_Pyra[iElem*NODES_PER_ELEMENT+iNode];
7463 Local_Nodes[iNode] = Global_to_Local_Point[iGlobal_Index];
7478 jElem++; iElemPyra++;
7497 cout <<
Global_nElem <<
" interior elements including halo cells. " << endl;
7564 unsigned short NODES_PER_ELEMENT;
7567 unsigned long iElem, iMarker, Global_Marker, iGlobal_Index;
7569 unsigned long iElem_Line = 0;
7570 unsigned long iElem_Tria = 0;
7571 unsigned long iElem_Quad = 0;
7575 vector<vector<unsigned long> > Line_List;
7576 vector<vector<unsigned long> > BoundTria_List;
7577 vector<vector<unsigned long> > BoundQuad_List;
7579 vector<unsigned long> Marker_Local;
7580 vector<unsigned long>::iterator it;
7586 for (iElem = 0; iElem < nLocal_Line; iElem++) {
7587 if (find(Marker_Local.begin(), Marker_Local.end(),
7588 ID_Line[iElem]) == Marker_Local.end()) {
7589 Marker_Local.push_back(ID_Line[iElem]);
7593 for (iElem = 0; iElem < nLocal_BoundTria; iElem++) {
7594 if (find(Marker_Local.begin(), Marker_Local.end(),
7595 ID_BoundTria[iElem]) == Marker_Local.end()) {
7596 Marker_Local.push_back(ID_BoundTria[iElem]);
7600 for (iElem = 0; iElem < nLocal_BoundQuad; iElem++) {
7601 if (find(Marker_Local.begin(), Marker_Local.end(),
7602 ID_BoundQuad[iElem]) == Marker_Local.end()) {
7603 Marker_Local.push_back(ID_BoundQuad[iElem]);
7609 map<unsigned long, unsigned long> Marker_Global_to_Local;
7610 map<unsigned long, unsigned long> Marker_Local_to_Global;
7612 for (iMarker = 0; iMarker < Marker_Local.size(); iMarker++) {
7613 Marker_Global_to_Local[Marker_Local[iMarker]] = iMarker;
7614 Marker_Local_to_Global[iMarker] = Marker_Local[iMarker];
7620 Line_List.resize(Marker_Local.size());
7621 BoundTria_List.resize(Marker_Local.size());
7622 BoundQuad_List.resize(Marker_Local.size());
7627 vector<unsigned long> nElemBound_Local;
7628 nElemBound_Local.resize(Marker_Local.size());
7629 for (iMarker = 0; iMarker < Marker_Local.size(); iMarker++)
7630 nElemBound_Local[iMarker] = 0;
7632 for (iElem = 0; iElem < nLocal_Line; iElem++) {
7633 iMarker = Marker_Global_to_Local[ID_Line[iElem]];
7634 if (find(Line_List[iMarker].begin(), Line_List[iMarker].end(),
7635 Elem_ID_Line[iElem]) == Line_List[iMarker].end()) {
7636 nElemBound_Local[iMarker]++;
7637 Line_List[iMarker].push_back(Elem_ID_Line[iElem]);
7641 for (iElem = 0; iElem < nLocal_BoundTria; iElem++) {
7642 iMarker = Marker_Global_to_Local[ID_BoundTria[iElem]];
7643 if (find(BoundTria_List[iMarker].begin(), BoundTria_List[iMarker].end(),
7644 Elem_ID_BoundTria[iElem]) == BoundTria_List[iMarker].end()) {
7645 nElemBound_Local[iMarker]++;
7646 BoundTria_List[iMarker].push_back(Elem_ID_BoundTria[iElem]);
7650 for (iElem = 0; iElem < nLocal_BoundQuad; iElem++) {
7651 iMarker = Marker_Global_to_Local[ID_BoundQuad[iElem]];
7652 if (find(BoundQuad_List[iMarker].begin(), BoundQuad_List[iMarker].end(),
7653 Elem_ID_BoundQuad[iElem]) == BoundQuad_List[iMarker].end()) {
7654 nElemBound_Local[iMarker]++;
7655 BoundQuad_List[iMarker].push_back(Elem_ID_BoundQuad[iElem]);
7663 nMarker = Marker_Local.size();
7670 for (iMarker = 0; iMarker <
nMarker; iMarker++)
7675 bound[iMarker] = NULL;
7677 for (iMarker = 0; iMarker <
nMarker; iMarker++)
7686 Line_List.clear(); Line_List.resize(Marker_Local.size());
7687 BoundTria_List.clear(); BoundTria_List.resize(Marker_Local.size());
7688 BoundQuad_List.clear(); BoundQuad_List.resize(Marker_Local.size());
7692 for (iMarker = 0; iMarker <
nMarker; iMarker++)
7693 nElemBound_Local[iMarker] = 0;
7699 for (iElem = 0; iElem < nLocal_Line; iElem++) {
7701 iMarker = Marker_Global_to_Local[ID_Line[iElem]];
7705 if (find(Line_List[iMarker].begin(), Line_List[iMarker].end(),
7706 Elem_ID_Line[iElem]) == Line_List[iMarker].end()) {
7712 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
7713 iGlobal_Index = Conn_Line[iElem*NODES_PER_ELEMENT+iNode];
7714 Local_Nodes[iNode] = Global_to_Local_Point[iGlobal_Index];
7719 bound[iMarker][nElemBound_Local[iMarker]] =
new CLine(Local_Nodes[0],
7724 nElemBound_Local[iMarker]++; iElem_Line++;
7726 Line_List[iMarker].push_back(Elem_ID_Line[iElem]);
7731 for (iElem = 0; iElem < nLocal_BoundTria; iElem++) {
7733 iMarker = Marker_Global_to_Local[ID_BoundTria[iElem]];
7737 if (find(BoundTria_List[iMarker].begin(), BoundTria_List[iMarker].end(),
7738 Elem_ID_BoundTria[iElem]) == BoundTria_List[iMarker].end()) {
7744 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
7745 iGlobal_Index = Conn_BoundTria[iElem*NODES_PER_ELEMENT+iNode];
7746 Local_Nodes[iNode] = Global_to_Local_Point[iGlobal_Index];
7751 bound[iMarker][nElemBound_Local[iMarker]] =
new CTriangle(Local_Nodes[0],
7757 nElemBound_Local[iMarker]++; iElem_Tria++;
7759 BoundTria_List[iMarker].push_back(Elem_ID_BoundTria[iElem]);
7764 for (iElem = 0; iElem < nLocal_BoundQuad; iElem++) {
7766 iMarker = Marker_Global_to_Local[ID_BoundQuad[iElem]];
7770 if (find(BoundQuad_List[iMarker].begin(), BoundQuad_List[iMarker].end(),
7771 Elem_ID_BoundQuad[iElem]) == BoundQuad_List[iMarker].end()) {
7777 for (iNode = 0; iNode < NODES_PER_ELEMENT; iNode++) {
7778 iGlobal_Index = Conn_BoundQuad[iElem*NODES_PER_ELEMENT+iNode];
7779 Local_Nodes[iNode] = Global_to_Local_Point[iGlobal_Index];
7791 nElemBound_Local[iMarker]++; iElem_Quad++;
7793 BoundQuad_List[iMarker].push_back(Elem_ID_BoundQuad[iElem]);
7806 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
7808 Global_Marker = Marker_Local_to_Global[iMarker];
7829 for (
unsigned short iMarker = 0; iMarker < 2; iMarker++){
7847 for (
unsigned short iMarker = 0; iMarker <
nMarker; iMarker++){
7889 unsigned short countPerElem,
7890 unsigned short commType) {
7894 int iMessage, iProc, offset,
nElem, count, source, dest, tag;
7899 for (iProc = 0; iProc <
size; iProc++) {
7905 if ((nElemRecv[iProc+1] > nElemRecv[iProc]) && (iProc !=
rank)) {
7909 offset = countPerElem*nElemRecv[iProc];
7914 nElem = nElemRecv[iProc+1] - nElemRecv[iProc];
7918 count = countPerElem*
nElem;
7922 source = iProc; tag = iProc + 1;
7928 &(recvReq[iMessage]));
7933 &(recvReq[iMessage]));
7938 &(recvReq[iMessage]));
7943 &(recvReq[iMessage]));
7948 &(recvReq[iMessage]));
7953 &(recvReq[iMessage]));
7958 &(recvReq[iMessage]));
7974 for (iProc = 0; iProc <
size; iProc++) {
7980 if ((nElemSend[iProc+1] > nElemSend[iProc]) && (iProc !=
rank)) {
7984 offset = countPerElem*nElemSend[iProc];
7989 nElem = nElemSend[iProc+1] - nElemSend[iProc];
7993 count = countPerElem*
nElem;
7997 dest = iProc; tag =
rank + 1;
8003 &(sendReq[iMessage]));
8008 &(sendReq[iMessage]));
8013 &(sendReq[iMessage]));
8018 &(sendReq[iMessage]));
8023 &(sendReq[iMessage]));
8028 &(sendReq[iMessage]));
8033 &(sendReq[iMessage]));
8055 int ind, iSend, iRecv;
8060 for (iSend = 0; iSend < nSends; iSend++)
8065 for (iRecv = 0; iRecv < nRecvs; iRecv++)
8072 unsigned short Counter_Send, Counter_Receive, iMarkerSend, iMarkerReceive;
8073 unsigned long iVertex, LocalNode;
8075 unsigned long iPoint, jPoint, iElem;
8076 unsigned long *nVertexDomain =
new unsigned long[nMarker_Max];
8077 unsigned short nDomain, iNode, iDomain, jDomain, jNode;
8078 vector<unsigned long>::iterator it;
8080 vector<vector<unsigned long> > SendTransfLocal;
8081 vector<vector<unsigned long> > ReceivedTransfLocal;
8082 vector<vector<unsigned long> > SendDomainLocal;
8083 vector<vector<unsigned long> > ReceivedDomainLocal;
8085 map<unsigned long, unsigned long>::const_iterator MI;
8088 cout <<
"Establishing MPI communication patterns." << endl;
8092 SendTransfLocal.resize(nDomain);
8093 ReceivedTransfLocal.resize(nDomain);
8094 SendDomainLocal.resize(nDomain);
8095 ReceivedDomainLocal.resize(nDomain);
8101 for (iElem = 0; iElem <
nElem; iElem++) {
8102 for (iNode = 0; iNode <
elem[iElem]->
GetnNodes(); iNode++) {
8107 if (iDomain ==
rank) {
8108 for (jNode = 0; jNode <
elem[iElem]->
GetnNodes(); jNode++) {
8116 if (iDomain != jDomain) {
8121 SendDomainLocal[jDomain].push_back(Local_to_Global_Point[iPoint]);
8126 ReceivedDomainLocal[jDomain].push_back(Local_to_Global_Point[jPoint]);
8137 for (iDomain = 0; iDomain < nDomain; iDomain++) {
8138 sort(SendDomainLocal[iDomain].begin(), SendDomainLocal[iDomain].end());
8139 it = unique(SendDomainLocal[iDomain].begin(), SendDomainLocal[iDomain].end());
8140 SendDomainLocal[iDomain].resize(it - SendDomainLocal[iDomain].begin());
8146 for (iDomain = 0; iDomain < nDomain; iDomain++) {
8147 sort(ReceivedDomainLocal[iDomain].begin(), ReceivedDomainLocal[iDomain].end());
8148 it = unique( ReceivedDomainLocal[iDomain].begin(), ReceivedDomainLocal[iDomain].end());
8149 ReceivedDomainLocal[iDomain].resize(it - ReceivedDomainLocal[iDomain].begin());
8155 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
8161 for (iPoint = 0; iPoint <
nPoint; iPoint++)
8162 Global_to_Local_Point[Local_to_Global_Point[iPoint]] = iPoint;
8167 for (iDomain = 0; iDomain < nDomain; iDomain++) {
8168 if (SendDomainLocal[iDomain].
size() != 0) {
8169 nVertexDomain[
nMarker] = SendDomainLocal[iDomain].size();
8170 for (iVertex = 0; iVertex < nVertexDomain[
nMarker]; iVertex++) {
8172 MI = Global_to_Local_Point.find(SendDomainLocal[iDomain][iVertex]);
8173 if (MI != Global_to_Local_Point.end())
8174 iPoint = Global_to_Local_Point[SendDomainLocal[iDomain][iVertex]];
8177 SendDomainLocal[iDomain][iVertex] = iPoint;
8178 SendTransfLocal[iDomain].push_back(0);
8187 for (iDomain = 0; iDomain < nDomain; iDomain++) {
8188 if (ReceivedDomainLocal[iDomain].
size() != 0) {
8189 nVertexDomain[
nMarker] = ReceivedDomainLocal[iDomain].size();
8190 for (iVertex = 0; iVertex < nVertexDomain[
nMarker]; iVertex++) {
8192 MI = Global_to_Local_Point.find(ReceivedDomainLocal[iDomain][iVertex]);
8193 if (MI != Global_to_Local_Point.end())
8194 iPoint = Global_to_Local_Point[ReceivedDomainLocal[iDomain][iVertex]];
8197 ReceivedDomainLocal[iDomain][iVertex] = iPoint;
8198 ReceivedTransfLocal[iDomain].push_back(0);
8207 Counter_Send = 0; Counter_Receive = 0;
8208 for (iDomain = 0; iDomain < nDomain; iDomain++)
8209 if (SendDomainLocal[iDomain].
size() != 0) Counter_Send++;
8211 for (iDomain = 0; iDomain < nDomain; iDomain++)
8212 if (ReceivedDomainLocal[iDomain].
size() != 0) Counter_Receive++;
8214 iMarkerSend =
nMarker - Counter_Send - Counter_Receive;
8215 iMarkerReceive =
nMarker - Counter_Receive;
8218 for (iDomain = 0; iDomain < nDomain; iDomain++) {
8219 if (SendDomainLocal[iDomain].
size() != 0) {
8220 for (iVertex = 0; iVertex <
GetnElem_Bound(iMarkerSend); iVertex++) {
8221 LocalNode = SendDomainLocal[iDomain][iVertex];
8231 for (iDomain = 0; iDomain < nDomain; iDomain++) {
8232 if (ReceivedDomainLocal[iDomain].
size() != 0) {
8233 for (iVertex = 0; iVertex <
GetnElem_Bound(iMarkerReceive); iVertex++) {
8234 LocalNode = ReceivedDomainLocal[iDomain][iVertex];
8245 delete [] nVertexDomain;
8251 unsigned long iElem_Bound, TotalElem, *nElem_Bound_Copy, iVertex_;
8253 unsigned short iDomain, nDomain, iMarkersDomain, iLoop, *DomainCount, nMarker_Physical, Duplicate_SendReceive, *DomainSendCount, **DomainSendMarkers, *DomainReceiveCount, **DomainReceiveMarkers, nMarker_SendRecv, iMarker, iMarker_;
8255 short *Marker_All_SendRecv_Copy;
8263 nMarker_Physical = 0;
8264 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
8273 Duplicate_SendReceive = 0;
8274 for (iLoop = 0; iLoop < 2; iLoop++) {
8276 DomainCount =
new unsigned short [nDomain];
8278 for (iDomain = 0; iDomain < nDomain; iDomain++)
8279 DomainCount[iDomain] = 0;
8282 for (iDomain = 0; iDomain < nDomain; iDomain++)
8283 for (iMarker = 0; iMarker <
nMarker; iMarker++)
8288 for (iDomain = 0; iDomain < nDomain; iDomain++)
8289 for (iMarker = 0; iMarker <
nMarker; iMarker++)
8294 for (iDomain = 0; iDomain < nDomain; iDomain++)
8295 if (DomainCount[iDomain] > 1) Duplicate_SendReceive++;
8297 delete [] DomainCount;
8301 DomainSendCount =
new unsigned short [nDomain];
8302 DomainSendMarkers =
new unsigned short *[nDomain];
8303 DomainReceiveCount =
new unsigned short [nDomain];
8304 DomainReceiveMarkers =
new unsigned short *[nDomain];
8306 for (iDomain = 0; iDomain < nDomain; iDomain++) {
8307 DomainSendCount[iDomain] = 0;
8308 DomainSendMarkers[iDomain] =
new unsigned short [
nMarker];
8310 DomainReceiveCount[iDomain] = 0;
8311 DomainReceiveMarkers[iDomain] =
new unsigned short [
nMarker];
8314 for (iDomain = 0; iDomain < nDomain; iDomain++) {
8315 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
8318 DomainSendMarkers[iDomain][DomainSendCount[iDomain]] = iMarker;
8319 DomainSendCount[iDomain]++;
8322 DomainReceiveMarkers[iDomain][DomainReceiveCount[iDomain]] = iMarker;
8323 DomainReceiveCount[iDomain]++;
8332 nMarker_SendRecv =
nMarker - nMarker_Physical - Duplicate_SendReceive;
8333 bound_Copy =
new CPrimalGrid**[nMarker_Physical + nMarker_SendRecv];
8334 nElem_Bound_Copy =
new unsigned long [nMarker_Physical + nMarker_SendRecv];
8335 Marker_All_SendRecv_Copy =
new short [nMarker_Physical + nMarker_SendRecv];
8336 iMarker_ = nMarker_Physical;
8342 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
8348 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
8349 if (
bound[iMarker][iElem_Bound]->GetVTK_Type() ==
LINE)
8350 bound_Copy[iMarker][iElem_Bound] =
new CLine(
bound[iMarker][iElem_Bound]->GetNode(0),
8351 bound[iMarker][iElem_Bound]->GetNode(1), 2);
8354 bound_Copy[iMarker][iElem_Bound] =
new CTriangle(
bound[iMarker][iElem_Bound]->GetNode(0),
8355 bound[iMarker][iElem_Bound]->GetNode(1),
8356 bound[iMarker][iElem_Bound]->GetNode(2), 3);
8358 bound_Copy[iMarker][iElem_Bound] =
new CQuadrilateral(
bound[iMarker][iElem_Bound]->GetNode(0),
8359 bound[iMarker][iElem_Bound]->GetNode(1),
8360 bound[iMarker][iElem_Bound]->GetNode(2),
8361 bound[iMarker][iElem_Bound]->GetNode(3), 3);
8367 for (iDomain = 0; iDomain < nDomain; iDomain++) {
8372 if (DomainSendCount[iDomain] != 0) {
8374 for (iMarkersDomain = 0; iMarkersDomain < DomainSendCount[iDomain]; iMarkersDomain++) {
8375 iMarker = DomainSendMarkers[iDomain][iMarkersDomain];
8378 if (CheckStart) iMarker_++;
8381 nElem_Bound_Copy[iMarker_] = TotalElem;
8382 bound_Copy[iMarker_] =
new CPrimalGrid*[TotalElem];
8385 for (iMarkersDomain = 0; iMarkersDomain < DomainSendCount[iDomain]; iMarkersDomain++) {
8386 iMarker = DomainSendMarkers[iDomain][iMarkersDomain];
8389 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
8390 bound_Copy[iMarker_][iVertex_] =
new CVertexMPI(
bound[iMarker][iElem_Bound]->GetNode(0),
nDim);
8400 if (DomainReceiveCount[iDomain] != 0) {
8402 for (iMarkersDomain = 0; iMarkersDomain < DomainReceiveCount[iDomain]; iMarkersDomain++) {
8403 iMarker = DomainReceiveMarkers[iDomain][iMarkersDomain];
8406 if (CheckStart) iMarker_++;
8409 nElem_Bound_Copy[iMarker_] = TotalElem;
8410 bound_Copy[iMarker_] =
new CPrimalGrid*[TotalElem];
8414 for (iMarkersDomain = 0; iMarkersDomain < DomainReceiveCount[iDomain]; iMarkersDomain++) {
8415 iMarker = DomainReceiveMarkers[iDomain][iMarkersDomain];
8418 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
8419 bound_Copy[iMarker_][iVertex_] =
new CVertexMPI(
bound[iMarker][iElem_Bound]->GetNode(0),
nDim);
8428 delete [] DomainSendCount;
8429 for (iDomain = 0; iDomain < nDomain; iDomain++)
8430 delete [] DomainSendMarkers[iDomain];
8431 delete[] DomainSendMarkers;
8433 delete [] DomainReceiveCount;
8434 for (iDomain = 0; iDomain < nDomain; iDomain++)
8435 delete [] DomainReceiveMarkers[iDomain];
8436 delete[] DomainReceiveMarkers;
8440 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
8441 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++)
8442 if (
bound[iMarker][iElem_Bound] != NULL)
delete bound[iMarker][iElem_Bound];
8443 if (
bound[iMarker] != NULL)
delete []
bound[iMarker];
8450 nMarker = nMarker_Physical + nMarker_SendRecv;
8454 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
8457 for (iMarker = nMarker_Physical; iMarker <
nMarker; iMarker++) {
8465 for (iMarker = 0 ; iMarker <
nMarker; iMarker++) {
8469 if (Marker_Tag !=
"SEND_RECEIVE") {
8509 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
8518 unsigned long Point_Surface, iElem_Surface;
8519 unsigned short iNode_Surface;
8521 for (iElem_Surface = 0; iElem_Surface <
nElem_Bound[iMarker]; iElem_Surface++) {
8522 for (iNode_Surface = 0; iNode_Surface <
bound[iMarker][iElem_Surface]->
GetnNodes(); iNode_Surface++) {
8523 Point_Surface =
bound[iMarker][iElem_Surface]->
GetNode(iNode_Surface);
8541 delete [] Marker_All_SendRecv_Copy;
8542 delete [] nElem_Bound_Copy;
8547 string text_line, Marker_Tag;
8550 unsigned long VTK_Type, iMarker, iChar;
8551 unsigned long iCount = 0;
8552 unsigned long iElem_Bound = 0, iPoint = 0, ielem = 0;
8553 unsigned long vnodes_edge[2], vnodes_triangle[3], vnodes_quad[4];
8554 unsigned long vnodes_tetra[4], vnodes_hexa[8], vnodes_prism[6],
8555 vnodes_pyramid[5], dummyLong, GlobalIndex, LocalIndex;
8558 vector<unsigned long>::iterator it;
8560 su2double Coord_2D[2], Coord_3D[3], AoA_Offset, AoS_Offset, AoA_Current, AoS_Current;
8561 string::size_type position;
8562 bool domain_flag =
false;
8563 bool found_transform =
false;
8575 unsigned long total_pt_accounted = 0;
8576 unsigned long rem_points = 0;
8577 unsigned long element_count = 0;
8578 unsigned long boundary_marker_count = 0;
8579 unsigned long node_count = 0;
8580 unsigned long local_element_count = 0;
8590 string Marker_Tag_Duplicate;
8591 bool *ActDisk_Bool = NULL, *MapVolumePointBool = NULL, InElem, Perimeter;
8592 unsigned long *ActDiskPoint_Back = NULL, *VolumePoint_Inv = NULL, *ActDiskPoint_Front_Inv = NULL, ActDiskNewPoints = 0, Counter = 0;
8593 su2double *CoordXActDisk = NULL, *CoordYActDisk = NULL, *CoordZActDisk = NULL;
8594 su2double *CoordXVolumePoint = NULL, *CoordYVolumePoint = NULL, *CoordZVolumePoint = NULL;
8595 su2double Xloc = 0.0, Yloc = 0.0, Zloc = 0.0, Xcg = 0.0;
8596 unsigned long nElem_Bound_, kPoint;
8598 vector<unsigned long long> EdgeBegin, EdgeEnd;
8600 unsigned long AuxEdge, iEdge, jEdge, nEdges, nPointVolume, iElem;
8601 unsigned long long FirstEdgeIndex, SecondEdgeIndex;
8603 vector<unsigned long> ActDiskPoint_Front, VolumePoint, PerimeterPoint;
8607 if (actuator_disk) {
8611 strcpy (cstr, val_mesh_filename.c_str());
8612 mesh_file.open(cstr, ios::in);
8616 if (mesh_file.fail()) {
8622 while (getline (mesh_file, text_line)) {
8624 position = text_line.find (
"NDIME=",0);
8625 if (position != string::npos) {
8626 text_line.erase (0,6);
nDim = atoi(text_line.c_str());
8629 position = text_line.find (
"NPOIN=",0);
8630 if (position != string::npos) {
8631 text_line.erase (0,6); stringstream test_line(text_line);
8632 iCount = 0;
while (test_line >> dummyLong) iCount++;
8633 stringstream stream_line(text_line);
8635 else if (iCount == 1) { stream_line >>
nPoint; }
8636 for (iPoint = 0; iPoint <
nPoint; iPoint++) getline (mesh_file, text_line);
8639 position = text_line.find (
"NELEM=",0);
8640 if (position != string::npos) {
8641 text_line.erase (0,6);
nElem = atoi(text_line.c_str());
8642 for (iElem = 0; iElem <
nElem; iElem++) getline (mesh_file, text_line);
8645 position = text_line.find (
"NMARK=",0);
8646 if (position != string::npos) {
8647 text_line.erase (0,6);
nMarker = atoi(text_line.c_str());
8649 for (iMarker = 0 ; iMarker <
nMarker; iMarker++) {
8651 getline (mesh_file, text_line);
8652 text_line.erase (0,11); string::size_type position;
8653 for (iChar = 0; iChar < 20; iChar++) {
8654 position = text_line.find(
" ", 0 );
if (position != string::npos) text_line.erase (position,1);
8655 position = text_line.find(
"\r", 0 );
if (position != string::npos) text_line.erase (position,1);
8656 position = text_line.find(
"\n", 0 );
if (position != string::npos) text_line.erase (position,1);
8658 Marker_Tag = text_line.c_str();
8660 getline (mesh_file, text_line);
8661 text_line.erase (0,13); nElem_Bound_ = atoi(text_line.c_str());
8664 cout <<
"Splitting the surface " << Marker_Tag <<
"( " << nElem_Bound_ <<
" boundary elements )." << endl;
8667 for (iElem_Bound = 0; iElem_Bound < nElem_Bound_; iElem_Bound++) { getline (mesh_file, text_line); }
8673 for (iElem_Bound = 0; iElem_Bound < nElem_Bound_; iElem_Bound++) {
8675 getline(mesh_file, text_line);
8677 istringstream bound_line(text_line); bound_line >> VTK_Type;
8681 bound_line >> vnodes_edge[0]; bound_line >> vnodes_edge[1];
8682 EdgeBegin.push_back(vnodes_edge[0]); EdgeEnd.push_back(vnodes_edge[1]);
8685 bound_line >> vnodes_triangle[0]; bound_line >> vnodes_triangle[1]; bound_line >> vnodes_triangle[2];
8686 EdgeBegin.push_back(vnodes_triangle[0]); EdgeEnd.push_back(vnodes_triangle[1]);
8687 EdgeBegin.push_back(vnodes_triangle[1]); EdgeEnd.push_back(vnodes_triangle[2]);
8688 EdgeBegin.push_back(vnodes_triangle[2]); EdgeEnd.push_back(vnodes_triangle[0]);
8691 bound_line >> vnodes_quad[0]; bound_line >> vnodes_quad[1]; bound_line >> vnodes_quad[2]; bound_line >> vnodes_quad[3];
8692 EdgeBegin.push_back(vnodes_quad[0]); EdgeEnd.push_back(vnodes_quad[1]);
8693 EdgeBegin.push_back(vnodes_quad[1]); EdgeEnd.push_back(vnodes_quad[2]);
8694 EdgeBegin.push_back(vnodes_quad[2]); EdgeEnd.push_back(vnodes_quad[3]);
8695 EdgeBegin.push_back(vnodes_quad[3]); EdgeEnd.push_back(vnodes_quad[0]);
8703 nEdges = EdgeBegin.size();
8707 for (iEdge = 0; iEdge < nEdges; iEdge++) {
8708 if (EdgeEnd[iEdge] < EdgeBegin[iEdge]) {
8709 AuxEdge = EdgeEnd[iEdge]; EdgeEnd[iEdge] = EdgeBegin[iEdge]; EdgeBegin[iEdge] = AuxEdge;
8715 for (iEdge = 0; iEdge < nEdges; iEdge++) {
8716 for (jEdge = iEdge+1; jEdge < nEdges; jEdge++) {
8718 FirstEdgeIndex = EdgeBegin[jEdge] << 31;
8719 FirstEdgeIndex += EdgeEnd[jEdge];
8721 SecondEdgeIndex = EdgeBegin[iEdge] << 31;
8722 SecondEdgeIndex += EdgeEnd[iEdge];
8724 if (FirstEdgeIndex <= SecondEdgeIndex) {
8725 AuxEdge = EdgeBegin[iEdge]; EdgeBegin[iEdge] = EdgeBegin[jEdge]; EdgeBegin[jEdge] = AuxEdge;
8726 AuxEdge = EdgeEnd[iEdge]; EdgeEnd[iEdge] = EdgeEnd[jEdge]; EdgeEnd[jEdge] = AuxEdge;
8735 if (!((EdgeBegin[0] == EdgeBegin[1]) && (EdgeEnd[0] == EdgeEnd[1]))) {
8736 PerimeterPoint.push_back(EdgeBegin[0]);
8737 PerimeterPoint.push_back(EdgeEnd[0]);
8740 for (iEdge = 1; iEdge < nEdges-1; iEdge++) {
8741 bool Check_1 = !((EdgeBegin[iEdge] == EdgeBegin[iEdge-1]) && (EdgeEnd[iEdge] == EdgeEnd[iEdge-1]));
8742 bool Check_2 = !((EdgeBegin[iEdge] == EdgeBegin[iEdge+1]) && (EdgeEnd[iEdge] == EdgeEnd[iEdge+1]));
8743 if ((Check_1 && Check_2)) {
8744 PerimeterPoint.push_back(EdgeBegin[iEdge]);
8745 PerimeterPoint.push_back(EdgeEnd[iEdge]);
8751 if (!((EdgeBegin[nEdges-1] == EdgeBegin[nEdges-2]) && (EdgeEnd[nEdges-1] == EdgeEnd[nEdges-2]))) {
8752 PerimeterPoint.push_back(EdgeBegin[nEdges-1]);
8753 PerimeterPoint.push_back(EdgeEnd[nEdges-1]);
8763 for (iEdge = 0; iEdge < nEdges; iEdge++) {
8764 ActDiskPoint_Front.push_back(EdgeBegin[iEdge]);
8765 ActDiskPoint_Front.push_back(EdgeEnd[iEdge]);
8768 sort(ActDiskPoint_Front.begin(), ActDiskPoint_Front.end());
8769 it = unique(ActDiskPoint_Front.begin(), ActDiskPoint_Front.end());
8770 ActDiskPoint_Front.resize(it - ActDiskPoint_Front.begin());
8774 if (!(ActDiskPoint_Front[0] == ActDiskPoint_Front[1]) ) { PerimeterPoint.push_back(ActDiskPoint_Front[0]); }
8776 for (iPoint = 1; iPoint < ActDiskPoint_Front.size()-1; iPoint++) {
8777 bool Check_1 = !((ActDiskPoint_Front[iPoint] == ActDiskPoint_Front[iPoint-1]) );
8778 bool Check_2 = !((ActDiskPoint_Front[iPoint] == ActDiskPoint_Front[iPoint+1]) );
8779 if ((Check_1 && Check_2)) { PerimeterPoint.push_back(ActDiskPoint_Front[iEdge]); }
8784 if (!((EdgeBegin[ActDiskPoint_Front.size()-1] == EdgeBegin[ActDiskPoint_Front.size()-2]) )) {
8785 PerimeterPoint.push_back(ActDiskPoint_Front[ActDiskPoint_Front.size()-1]);
8788 ActDiskPoint_Front.clear();
8792 sort(PerimeterPoint.begin(), PerimeterPoint.end());
8793 it = unique(PerimeterPoint.begin(), PerimeterPoint.end());
8794 PerimeterPoint.resize(it - PerimeterPoint.begin());
8796 for (iEdge = 0; iEdge < nEdges; iEdge++) {
8799 for (iPoint = 0; iPoint < PerimeterPoint.size(); iPoint++) {
8800 if (EdgeBegin[iEdge] == PerimeterPoint[iPoint]) {
8801 Perimeter =
true;
break;
8805 if (!Perimeter) ActDiskPoint_Front.push_back(EdgeBegin[iEdge]);
8808 for (iPoint = 0; iPoint < PerimeterPoint.size(); iPoint++) {
8809 if (EdgeEnd[iEdge] == PerimeterPoint[iPoint]) {
8810 Perimeter =
true;
break;
8814 if (!Perimeter) ActDiskPoint_Front.push_back(EdgeEnd[iEdge]);
8820 sort(ActDiskPoint_Front.begin(), ActDiskPoint_Front.end());
8821 it = unique(ActDiskPoint_Front.begin(), ActDiskPoint_Front.end());
8822 ActDiskPoint_Front.resize(it - ActDiskPoint_Front.begin());
8823 ActDiskNewPoints = ActDiskPoint_Front.size();
8826 cout <<
"Splitting the surface " << Marker_Tag <<
"( " << ActDiskPoint_Front.size() <<
" internal points )." << endl;
8830 ActDiskPoint_Back =
new unsigned long [
nPoint];
8831 ActDisk_Bool =
new bool [
nPoint];
8832 ActDiskPoint_Front_Inv=
new unsigned long [
nPoint];
8834 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
8835 ActDisk_Bool[iPoint] =
false;
8836 ActDiskPoint_Back[iPoint] = 0;
8840 for (iPoint = 0; iPoint < ActDiskPoint_Front.size(); iPoint++) {
8841 ActDiskPoint_Front_Inv[ActDiskPoint_Front[iPoint]] = iPoint;
8842 ActDisk_Bool[ActDiskPoint_Front[iPoint]] =
true;
8843 ActDiskPoint_Back[ActDiskPoint_Front[iPoint]] = kPoint;
8856 CoordXActDisk =
new su2double[ActDiskNewPoints];
8857 CoordYActDisk =
new su2double[ActDiskNewPoints];
8858 CoordZActDisk =
new su2double[ActDiskNewPoints];
8860 strcpy (cstr, val_mesh_filename.c_str());
8861 mesh_file.open(cstr, ios::in);
8866 while (getline (mesh_file, text_line)) {
8868 position = text_line.find (
"NPOIN=",0);
8869 if (position != string::npos) {
8870 text_line.erase (0,6); stringstream test_line(text_line);
8871 iCount = 0;
while (test_line >> dummyLong) iCount++;
8872 stringstream stream_line(text_line);
8874 else if (iCount == 1) { stream_line >>
nPoint; }
8877 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
8878 getline (mesh_file, text_line);
8879 istringstream point_line(text_line);
8880 if (
nDim == 2) {point_line >> Coord_2D[0]; point_line >> Coord_2D[1]; }
8881 else { point_line >> Coord_3D[0]; point_line >> Coord_3D[1]; point_line >> Coord_3D[2]; }
8885 if (ActDisk_Bool[iPoint]) {
8886 CoordXActDisk[ActDiskPoint_Front_Inv[iPoint]] = Coord_3D[0];
8887 CoordYActDisk[ActDiskPoint_Front_Inv[iPoint]] = Coord_3D[1];
8888 Xloc += Coord_3D[0]; Yloc += Coord_3D[1];
8890 CoordZActDisk[ActDiskPoint_Front_Inv[iPoint]] = Coord_3D[2];
8891 Zloc += Coord_3D[2];
8901 position = text_line.find (
"NELEM=",0);
8902 if (position != string::npos) {
8903 text_line.erase (0,6);
nElem = atol(text_line.c_str());
8904 for (iElem = 0; iElem <
nElem; iElem++) {
8906 getline(mesh_file, text_line);
8907 istringstream elem_line(text_line);
8909 elem_line >> VTK_Type;
8913 elem_line >> vnodes_triangle[0]; elem_line >> vnodes_triangle[1]; elem_line >> vnodes_triangle[2];
8916 if (ActDisk_Bool[vnodes_triangle[i]]) { InElem =
true;
break; } }
8919 VolumePoint.push_back(vnodes_triangle[i]); } }
8922 elem_line >> vnodes_quad[0]; elem_line >> vnodes_quad[1]; elem_line >> vnodes_quad[2]; elem_line >> vnodes_quad[3];
8925 if (ActDisk_Bool[vnodes_quad[i]]) { InElem =
true;
break; } }
8928 VolumePoint.push_back(vnodes_quad[i]); } }
8931 elem_line >> vnodes_tetra[0]; elem_line >> vnodes_tetra[1]; elem_line >> vnodes_tetra[2]; elem_line >> vnodes_tetra[3];
8934 if (ActDisk_Bool[vnodes_tetra[i]]) { InElem =
true;
break; } }
8937 VolumePoint.push_back(vnodes_tetra[i]); } }
8940 elem_line >> vnodes_hexa[0]; elem_line >> vnodes_hexa[1]; elem_line >> vnodes_hexa[2];
8941 elem_line >> vnodes_hexa[3]; elem_line >> vnodes_hexa[4]; elem_line >> vnodes_hexa[5];
8942 elem_line >> vnodes_hexa[6]; elem_line >> vnodes_hexa[7];
8945 if (ActDisk_Bool[vnodes_hexa[i]]) { InElem =
true;
break; } }
8948 VolumePoint.push_back(vnodes_hexa[i]); } }
8951 elem_line >> vnodes_prism[0]; elem_line >> vnodes_prism[1]; elem_line >> vnodes_prism[2];
8952 elem_line >> vnodes_prism[3]; elem_line >> vnodes_prism[4]; elem_line >> vnodes_prism[5];
8955 if (ActDisk_Bool[vnodes_prism[i]]) { InElem =
true;
break; } }
8958 VolumePoint.push_back(vnodes_prism[i]); } }
8961 elem_line >> vnodes_pyramid[0]; elem_line >> vnodes_pyramid[1]; elem_line >> vnodes_pyramid[2];
8962 elem_line >> vnodes_pyramid[3]; elem_line >> vnodes_pyramid[4];
8965 if (ActDisk_Bool[vnodes_pyramid[i]]) { InElem =
true;
break; } }
8968 VolumePoint.push_back(vnodes_pyramid[i]); } }
8984 sort(VolumePoint.begin(), VolumePoint.end());
8985 it = unique(VolumePoint.begin(), VolumePoint.end());
8986 VolumePoint.resize(it - VolumePoint.begin());
8987 nPointVolume = VolumePoint.size();
8990 CoordXVolumePoint =
new su2double[nPointVolume];
8991 CoordYVolumePoint =
new su2double[nPointVolume];
8992 CoordZVolumePoint =
new su2double[nPointVolume];
8993 MapVolumePointBool =
new bool[
nPoint];
8994 VolumePoint_Inv =
new unsigned long[
nPoint];
8996 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
8997 MapVolumePointBool[iPoint] =
false;
9000 for (iPoint = 0; iPoint < nPointVolume; iPoint++) {
9001 MapVolumePointBool[VolumePoint[iPoint]] =
true;
9002 VolumePoint_Inv[VolumePoint[iPoint]] = iPoint;
9005 strcpy (cstr, val_mesh_filename.c_str());
9006 mesh_file.open(cstr, ios::in);
9011 while (getline (mesh_file, text_line)) {
9013 position = text_line.find (
"NPOIN=",0);
9014 if (position != string::npos) {
9015 text_line.erase (0,6); stringstream test_line(text_line);
9016 iCount = 0;
while (test_line >> dummyLong) iCount++;
9017 stringstream stream_line(text_line);
9019 else if (iCount == 1) { stream_line >>
nPoint; }
9022 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
9023 getline (mesh_file, text_line);
9024 istringstream point_line(text_line);
9025 if (
nDim == 2) {point_line >> Coord_2D[0]; point_line >> Coord_2D[1]; }
9026 else { point_line >> Coord_3D[0]; point_line >> Coord_3D[1]; point_line >> Coord_3D[2]; }
9028 if (MapVolumePointBool[iPoint]) {
9029 CoordXVolumePoint[VolumePoint_Inv[iPoint]] = Coord_3D[0];
9030 CoordYVolumePoint[VolumePoint_Inv[iPoint]] = Coord_3D[1];
9031 if (
nDim == 3) { CoordZVolumePoint[VolumePoint_Inv[iPoint]] = Coord_3D[2]; }
9042 delete [] MapVolumePointBool;
9043 delete [] ActDiskPoint_Front_Inv;
9099 strcpy (cstr, val_mesh_filename.c_str());
9100 mesh_file.open(cstr, ios::in);
9104 if (mesh_file.fail()) {
9110 if (val_nZone > 1 || harmonic_balance) {
9111 if (harmonic_balance) {
9114 while (getline (mesh_file,text_line)) {
9116 position = text_line.find (
"IZONE=",0);
9117 if (position != string::npos) {
9118 text_line.erase (0,6);
9119 unsigned short jDomain = atoi(text_line.c_str());
9120 if (jDomain == val_iZone+1) {
9121 if (
rank ==
MASTER_NODE) cout <<
"Reading zone " << val_iZone+1 <<
"." << endl;
9131 while (getline (mesh_file, text_line)) {
9135 position = text_line.find (
"NDIME=",0);
9136 if (position != string::npos) {
9137 if (domain_flag ==
false) {
9138 text_line.erase (0,6);
nDim = atoi(text_line.c_str());
9140 if (
nDim == 2) cout <<
"Two dimensional problem." << endl;
9141 if (
nDim == 3) cout <<
"Three dimensional problem." << endl;
9149 position = text_line.find (
"AOA_OFFSET=",0);
9150 if (position != string::npos) {
9152 text_line.erase (0,11); AoA_Offset = atof(text_line.c_str());
9156 AoA_Current = config->
GetAoA() + AoA_Offset;
9161 cout << fixed <<
"WARNING: AoA in the config file (" << config->
GetAoA() <<
" deg.) +" << endl;
9162 cout <<
" AoA offset in mesh file (" << AoA_Offset <<
" deg.) = " << AoA_Current <<
" deg." << endl;
9165 config->
SetAoA(AoA_Current);
9169 cout <<
"WARNING: Discarding the AoA offset in the geometry file." << endl;
9174 position = text_line.find (
"AOS_OFFSET=",0);
9175 if (position != string::npos) {
9177 text_line.erase (0,11); AoS_Offset = atof(text_line.c_str());
9181 AoS_Current = config->
GetAoS() + AoS_Offset;
9186 cout << fixed <<
"WARNING: AoS in the config file (" << config->
GetAoS() <<
" deg.) +" << endl;
9187 cout <<
" AoS offset in mesh file (" << AoS_Offset <<
" deg.) = " << AoS_Current <<
" deg." << endl;
9190 config->
SetAoS(AoS_Current);
9194 cout <<
"WARNING: Discarding the AoS offset in the geometry file." << endl;
9201 position = text_line.find (
"NPOIN=",0);
9202 if (position != string::npos) {
9203 text_line.erase (0,6);
9206 stringstream test_line(text_line);
9207 iCount = 0;
while (test_line >> dummyLong) iCount++;
9211 stringstream stream_line(text_line);
9225 cout <<
" ghost points before parallel partitioning." << endl;
9228 cout <<
" ghost points." << endl;
9231 }
else if (iCount == 1) {
9234 if (actuator_disk) {
nPoint += ActDiskNewPoints; }
9240 cout <<
nPoint <<
" points before parallel partitioning." << endl;
9242 cout <<
nPoint <<
" points." << endl;
9250 cout <<
"Performing linear partitioning of the grid nodes." << endl;
9256 total_pt_accounted = 0;
9257 for (i = 0; i < (
unsigned long)
size; i++) {
9259 total_pt_accounted = total_pt_accounted +
npoint_procs[i];
9264 rem_points =
nPoint-total_pt_accounted;
9265 for (i = 0; i<rem_points; i++) {
9276 for (
unsigned long i = 1; i < (
unsigned long)
size; i++) {
9289 iPoint = 0; node_count = 0;
9292 if (!actuator_disk) { getline(mesh_file, text_line); }
9295 getline(mesh_file, text_line);
9298 ostringstream strsX, strsY, strsZ;
9299 unsigned long BackActDisk_Index = node_count;
9300 LocalIndex = BackActDisk_Index - (
Global_nPoint-ActDiskNewPoints);
9301 strsX.precision(20); strsY.precision(20); strsZ.precision(20);
9302 su2double CoordX = CoordXActDisk[LocalIndex]; strsX << scientific << CoordX;
9303 su2double CoordY = CoordYActDisk[LocalIndex]; strsY << scientific << CoordY;
9304 su2double CoordZ = CoordZActDisk[LocalIndex]; strsZ << scientific << CoordZ;
9305 text_line = strsX.str() +
"\t" + strsY.str() +
"\t" + strsZ.str();
9309 istringstream point_line(text_line);
9317 GlobalIndex = node_count;
9319 point_line >> Coord_2D[0]; point_line >> Coord_2D[1];
9321 if (
size >
SINGLE_NODE) { point_line >> Coord_2D[0]; point_line >> Coord_2D[1]; GlobalIndex = node_count; }
9322 else { point_line >> Coord_2D[0]; point_line >> Coord_2D[1]; GlobalIndex = node_count; }
9324 node[iPoint] =
new CPoint(Coord_2D[0], Coord_2D[1], GlobalIndex, config);
9327 GlobalIndex = node_count;
9329 point_line >> Coord_3D[0]; point_line >> Coord_3D[1]; point_line >> Coord_3D[2];
9331 if (
size >
SINGLE_NODE) { point_line >> Coord_3D[0]; point_line >> Coord_3D[1]; point_line >> Coord_3D[2]; GlobalIndex = node_count; }
9332 else { point_line >> Coord_3D[0]; point_line >> Coord_3D[1]; point_line >> Coord_3D[2]; GlobalIndex = node_count; }
9334 node[iPoint] =
new CPoint(Coord_3D[0], Coord_3D[1], Coord_3D[2], GlobalIndex, config);
9344 strcpy (cstr, val_mesh_filename.c_str());
9351 map<unsigned long,bool> ElemIn;
9352 map<unsigned long, bool>::const_iterator MI;
9354 #ifdef HAVE_PARMETIS
9356 vector< vector<unsigned long> > adj_nodes(
nPoint, vector<unsigned long>(0));
9362 mesh_file.open(cstr, ios::in);
9366 if (val_nZone > 1) {
9367 while (getline (mesh_file,text_line)) {
9369 position = text_line.find (
"IZONE=",0);
9370 if (position != string::npos) {
9371 text_line.erase (0,6);
9372 unsigned short jDomain = atoi(text_line.c_str());
9373 if (jDomain == val_iZone+1) {
9380 while (getline (mesh_file, text_line)) {
9384 position = text_line.find (
"NELEM=",0);
9385 if (position != string::npos) {
9386 text_line.erase (0,6);
nElem = atol(text_line.c_str());
9392 cout <<
Global_nElem <<
" interior elements before parallel partitioning." << endl;
9399 element_count = 0; local_element_count = 0;
9401 getline(mesh_file, text_line);
9402 istringstream elem_line(text_line);
9408 elem_line >> VTK_Type;
9415 elem_line >> vnodes_triangle[0];
9416 elem_line >> vnodes_triangle[1];
9417 elem_line >> vnodes_triangle[2];
9419 if (actuator_disk) {
9421 if (ActDisk_Bool[vnodes_triangle[i]]) {
9423 Xcg = 0.0; Counter = 0;
9426 Xcg += CoordXVolumePoint[VolumePoint_Inv[vnodes_triangle[j]]];
9434 vnodes_triangle[i] = ActDiskPoint_Back[vnodes_triangle[i]];
9436 else { vnodes_triangle[i] = vnodes_triangle[i]; }
9451 if ((local_index >= 0) && (local_index < (
long)
nPoint)) {
9457 ElemIn[element_count] =
true;
9460 #ifdef HAVE_PARMETIS
9463 if (i != j) adj_nodes[local_index].push_back(vnodes_triangle[j]);
9470 MI = ElemIn.find(element_count);
9471 if (MI != ElemIn.end()) local_element_count++;
9479 elem_line >> vnodes_quad[0];
9480 elem_line >> vnodes_quad[1];
9481 elem_line >> vnodes_quad[2];
9482 elem_line >> vnodes_quad[3];
9484 if (actuator_disk) {
9486 if (ActDisk_Bool[vnodes_quad[i]]) {
9488 Xcg = 0.0; Counter = 0;
9491 Xcg += CoordXVolumePoint[VolumePoint_Inv[vnodes_quad[j]]];
9500 vnodes_quad[i] = ActDiskPoint_Back[vnodes_quad[i]];
9502 else { vnodes_quad[i] = vnodes_quad[i]; }
9517 if ((local_index >= 0) && (local_index < (
long)
nPoint)) {
9523 ElemIn[element_count] =
true;
9526 #ifdef HAVE_PARMETIS
9528 adj_nodes[local_index].push_back(vnodes_quad[(i+1)%4]);
9529 adj_nodes[local_index].push_back(vnodes_quad[(i+3)%4]);
9535 MI = ElemIn.find(element_count);
9536 if (MI != ElemIn.end()) local_element_count++;
9544 elem_line >> vnodes_tetra[0];
9545 elem_line >> vnodes_tetra[1];
9546 elem_line >> vnodes_tetra[2];
9547 elem_line >> vnodes_tetra[3];
9549 if (actuator_disk) {
9551 if (ActDisk_Bool[vnodes_tetra[i]]) {
9553 Xcg = 0.0; Counter = 0;
9556 Xcg += CoordXVolumePoint[VolumePoint_Inv[vnodes_tetra[j]]];
9565 vnodes_tetra[i] = ActDiskPoint_Back[vnodes_tetra[i]];
9567 else { vnodes_tetra[i] = vnodes_tetra[i]; }
9582 if ((local_index >= 0) && (local_index < (
long)
nPoint)) {
9588 ElemIn[element_count] =
true;
9591 #ifdef HAVE_PARMETIS
9594 if (i != j) adj_nodes[local_index].push_back(vnodes_tetra[j]);
9601 MI = ElemIn.find(element_count);
9602 if (MI != ElemIn.end()) local_element_count++;
9610 elem_line >> vnodes_hexa[0];
9611 elem_line >> vnodes_hexa[1];
9612 elem_line >> vnodes_hexa[2];
9613 elem_line >> vnodes_hexa[3];
9614 elem_line >> vnodes_hexa[4];
9615 elem_line >> vnodes_hexa[5];
9616 elem_line >> vnodes_hexa[6];
9617 elem_line >> vnodes_hexa[7];
9619 if (actuator_disk) {
9621 if (ActDisk_Bool[vnodes_hexa[i]]) {
9623 Xcg = 0.0; Counter = 0;
9626 Xcg += CoordXVolumePoint[VolumePoint_Inv[vnodes_hexa[j]]];
9633 if (Xcg > Xloc) { vnodes_hexa[i] = ActDiskPoint_Back[vnodes_hexa[i]]; }
9634 else { vnodes_hexa[i] = vnodes_hexa[i]; }
9648 if ((local_index >= 0) && (local_index < (
long)
nPoint)) {
9654 ElemIn[element_count] =
true;
9657 #ifdef HAVE_PARMETIS
9660 adj_nodes[local_index].push_back(vnodes_hexa[(i+1)%4]);
9661 adj_nodes[local_index].push_back(vnodes_hexa[(i+3)%4]);
9663 adj_nodes[local_index].push_back(vnodes_hexa[(i-3)%4+4]);
9664 adj_nodes[local_index].push_back(vnodes_hexa[(i-1)%4+4]);
9666 adj_nodes[local_index].push_back(vnodes_hexa[(i+4)%8]);
9672 MI = ElemIn.find(element_count);
9673 if (MI != ElemIn.end()) local_element_count++;
9681 elem_line >> vnodes_prism[0];
9682 elem_line >> vnodes_prism[1];
9683 elem_line >> vnodes_prism[2];
9684 elem_line >> vnodes_prism[3];
9685 elem_line >> vnodes_prism[4];
9686 elem_line >> vnodes_prism[5];
9688 if (actuator_disk) {
9690 if (ActDisk_Bool[vnodes_prism[i]]) {
9692 Xcg = 0.0; Counter = 0;
9695 Xcg += CoordXVolumePoint[VolumePoint_Inv[vnodes_prism[j]]];
9702 if (Xcg > Xloc) { vnodes_prism[i] = ActDiskPoint_Back[vnodes_prism[i]]; }
9703 else { vnodes_prism[i] = vnodes_prism[i]; }
9717 if ((local_index >= 0) && (local_index < (
long)
nPoint)) {
9723 ElemIn[element_count] =
true;
9726 #ifdef HAVE_PARMETIS
9729 adj_nodes[local_index].push_back(vnodes_prism[(i+1)%3]);
9730 adj_nodes[local_index].push_back(vnodes_prism[(i+2)%3]);
9732 adj_nodes[local_index].push_back(vnodes_prism[(i-2)%3+3]);
9733 adj_nodes[local_index].push_back(vnodes_prism[(i-1)%3+3]);
9735 adj_nodes[local_index].push_back(vnodes_prism[(i+3)%6]);
9741 MI = ElemIn.find(element_count);
9742 if (MI != ElemIn.end()) local_element_count++;
9750 elem_line >> vnodes_pyramid[0];
9751 elem_line >> vnodes_pyramid[1];
9752 elem_line >> vnodes_pyramid[2];
9753 elem_line >> vnodes_pyramid[3];
9754 elem_line >> vnodes_pyramid[4];
9756 if (actuator_disk) {
9758 if (ActDisk_Bool[vnodes_pyramid[i]]) {
9760 Xcg = 0.0; Counter = 0;
9763 Xcg += CoordXVolumePoint[VolumePoint_Inv[vnodes_pyramid[j]]];
9770 if (Xcg > Xloc) { vnodes_pyramid[i] = ActDiskPoint_Back[vnodes_pyramid[i]]; }
9771 else { vnodes_pyramid[i] = vnodes_pyramid[i]; }
9785 if ((local_index >= 0) && (local_index < (
long)
nPoint)) {
9791 ElemIn[element_count] =
true;
9794 #ifdef HAVE_PARMETIS
9797 adj_nodes[local_index].push_back(vnodes_pyramid[(i+1)%4]);
9798 adj_nodes[local_index].push_back(vnodes_pyramid[(i+3)%4]);
9799 adj_nodes[local_index].push_back(vnodes_pyramid[4]);
9801 adj_nodes[local_index].push_back(vnodes_pyramid[0]);
9802 adj_nodes[local_index].push_back(vnodes_pyramid[1]);
9803 adj_nodes[local_index].push_back(vnodes_pyramid[2]);
9804 adj_nodes[local_index].push_back(vnodes_pyramid[3]);
9811 MI = ElemIn.find(element_count);
9812 if (MI != ElemIn.end()) local_element_count++;
9831 nElem = local_element_count;
9837 #ifdef HAVE_PARMETIS
9840 cout <<
"Executing the partitioning functions." << endl;
9847 cout <<
"Building the graph adjacency structure." << endl;
9849 unsigned long loc_adjc_size=0;
9850 vector<unsigned long> adjac_vec;
9851 unsigned long adj_elem_size;
9855 vector<unsigned long> temp_adjacency;
9856 unsigned long local_count=0;
9863 for (
unsigned long i = 0; i <
nPoint; i++) {
9865 for (j = 0; j<adj_nodes[i].size(); j++) {
9866 temp_adjacency.push_back(adj_nodes[i][j]);
9869 sort(temp_adjacency.begin(), temp_adjacency.end());
9870 it = unique(temp_adjacency.begin(), temp_adjacency.end());
9871 loc_adjc_size = it - temp_adjacency.begin();
9873 temp_adjacency.resize(loc_adjc_size);
9874 xadj[local_count+1]=xadj[local_count]+loc_adjc_size;
9877 for (j = 0; j<loc_adjc_size; j++) {
9878 adjac_vec.push_back(temp_adjacency[j]);
9881 temp_adjacency.clear();
9882 adj_nodes[i].clear();
9890 adjacency =
new idx_t [adj_elem_size];
9891 copy(adjac_vec.begin(), adjac_vec.end(), adjacency);
9907 mesh_file.open(cstr, ios::in);
9911 if (val_nZone > 1) {
9912 while (getline (mesh_file,text_line)) {
9914 position = text_line.find (
"IZONE=",0);
9915 if (position != string::npos) {
9916 text_line.erase (0,6);
9917 unsigned short jDomain = atoi(text_line.c_str());
9918 if (jDomain == val_iZone+1) {
9925 while (getline (mesh_file, text_line)) {
9929 position = text_line.find (
"NELEM=",0);
9930 if (position != string::npos) {
9939 cout <<
"Distributing elements across all ranks." << endl;
9946 element_count = 0; local_element_count = 0;
9948 getline(mesh_file, text_line);
9949 istringstream elem_line(text_line);
9953 map<unsigned long, bool>::const_iterator MI = ElemIn.find(element_count);
9954 if (MI != ElemIn.end()) {
9956 elem_line >> VTK_Type;
9963 elem_line >> vnodes_triangle[0];
9964 elem_line >> vnodes_triangle[1];
9965 elem_line >> vnodes_triangle[2];
9967 if (actuator_disk) {
9969 if (ActDisk_Bool[vnodes_triangle[i]]) {
9971 Xcg = 0.0; Counter = 0;
9974 Xcg += CoordXVolumePoint[VolumePoint_Inv[vnodes_triangle[j]]];
9982 vnodes_triangle[i] = ActDiskPoint_Back[vnodes_triangle[i]];
9984 else { vnodes_triangle[i] = vnodes_triangle[i]; }
9995 elem[local_element_count] =
new CTriangle(vnodes_triangle[0],
9997 vnodes_triangle[2], 2);
9998 local_element_count++;
10006 elem_line >> vnodes_quad[0];
10007 elem_line >> vnodes_quad[1];
10008 elem_line >> vnodes_quad[2];
10009 elem_line >> vnodes_quad[3];
10011 if (actuator_disk) {
10013 if (ActDisk_Bool[vnodes_quad[i]]) {
10015 Xcg = 0.0; Counter = 0;
10018 Xcg += CoordXVolumePoint[VolumePoint_Inv[vnodes_quad[j]]];
10025 if (Counter != 0) {
10027 vnodes_quad[i] = ActDiskPoint_Back[vnodes_quad[i]];
10029 else { vnodes_quad[i] = vnodes_quad[i]; }
10043 vnodes_quad[3], 2);
10044 local_element_count++;
10052 elem_line >> vnodes_tetra[0];
10053 elem_line >> vnodes_tetra[1];
10054 elem_line >> vnodes_tetra[2];
10055 elem_line >> vnodes_tetra[3];
10057 if (actuator_disk) {
10059 if (ActDisk_Bool[vnodes_tetra[i]]) {
10061 Xcg = 0.0; Counter = 0;
10064 Xcg += CoordXVolumePoint[VolumePoint_Inv[vnodes_tetra[j]]];
10071 if (Counter != 0) {
10073 vnodes_tetra[i] = ActDiskPoint_Back[vnodes_tetra[i]];
10075 else { vnodes_tetra[i] = vnodes_tetra[i]; }
10090 local_element_count++;
10098 elem_line >> vnodes_hexa[0];
10099 elem_line >> vnodes_hexa[1];
10100 elem_line >> vnodes_hexa[2];
10101 elem_line >> vnodes_hexa[3];
10102 elem_line >> vnodes_hexa[4];
10103 elem_line >> vnodes_hexa[5];
10104 elem_line >> vnodes_hexa[6];
10105 elem_line >> vnodes_hexa[7];
10107 if (actuator_disk) {
10109 if (ActDisk_Bool[vnodes_hexa[i]]) {
10111 Xcg = 0.0; Counter = 0;
10114 Xcg += CoordXVolumePoint[VolumePoint_Inv[vnodes_hexa[j]]];
10120 if (Counter != 0) {
10121 if (Xcg > Xloc) { vnodes_hexa[i] = ActDiskPoint_Back[vnodes_hexa[i]]; }
10122 else { vnodes_hexa[i] = vnodes_hexa[i]; }
10140 local_element_count++;
10148 elem_line >> vnodes_prism[0];
10149 elem_line >> vnodes_prism[1];
10150 elem_line >> vnodes_prism[2];
10151 elem_line >> vnodes_prism[3];
10152 elem_line >> vnodes_prism[4];
10153 elem_line >> vnodes_prism[5];
10155 if (actuator_disk) {
10157 if (ActDisk_Bool[vnodes_prism[i]]) {
10159 Xcg = 0.0; Counter = 0;
10162 Xcg += CoordXVolumePoint[VolumePoint_Inv[vnodes_prism[j]]];
10168 if (Counter != 0) {
10169 if (Xcg > Xloc) { vnodes_prism[i] = ActDiskPoint_Back[vnodes_prism[i]]; }
10170 else { vnodes_prism[i] = vnodes_prism[i]; }
10180 elem[local_element_count] =
new CPrism(vnodes_prism[0],
10186 local_element_count++;
10194 elem_line >> vnodes_pyramid[0];
10195 elem_line >> vnodes_pyramid[1];
10196 elem_line >> vnodes_pyramid[2];
10197 elem_line >> vnodes_pyramid[3];
10198 elem_line >> vnodes_pyramid[4];
10200 if (actuator_disk) {
10202 if (ActDisk_Bool[vnodes_pyramid[i]]) {
10204 Xcg = 0.0; Counter = 0;
10207 Xcg += CoordXVolumePoint[VolumePoint_Inv[vnodes_pyramid[j]]];
10213 if (Counter != 0) {
10214 if (Xcg > Xloc) { vnodes_pyramid[i] = ActDiskPoint_Back[vnodes_pyramid[i]]; }
10215 else { vnodes_pyramid[i] = vnodes_pyramid[i]; }
10225 elem[local_element_count] =
new CPyramid(vnodes_pyramid[0],
10229 vnodes_pyramid[4]);
10230 local_element_count++;
10248 mesh_file.open(cstr, ios::in);
10253 if (val_nZone > 1) {
10254 while (getline (mesh_file,text_line)) {
10256 position = text_line.find (
"IZONE=",0);
10257 if (position != string::npos) {
10258 text_line.erase (0,6);
10259 unsigned short jDomain = atoi(text_line.c_str());
10260 if (jDomain == val_iZone+1) {
10267 while (getline (mesh_file, text_line)) {
10271 position = text_line.find (
"NMARK=",0);
10272 boundary_marker_count = 0;
10274 if (position != string::npos) {
10275 text_line.erase (0,6);
nMarker = atoi(text_line.c_str());
10277 if (actuator_disk) {
nMarker++; }
10285 bool duplicate =
false;
10289 getline (mesh_file, text_line);
10290 text_line.erase (0,11);
10291 string::size_type position;
10293 for (iChar = 0; iChar < 20; iChar++) {
10294 position = text_line.find(
" ", 0 );
10295 if (position != string::npos) text_line.erase (position,1);
10296 position = text_line.find(
"\r", 0 );
10297 if (position != string::npos) text_line.erase (position,1);
10298 position = text_line.find(
"\n", 0 );
10299 if (position != string::npos) text_line.erase (position,1);
10301 Marker_Tag = text_line.c_str();
10311 if (Marker_Tag !=
"SEND_RECEIVE") {
10312 getline (mesh_file, text_line);
10313 text_line.erase (0,13);
nElem_Bound[iMarker] = atoi(text_line.c_str());
10317 cout <<
nElem_Bound[iMarker] <<
" boundary elements in index "<< iMarker <<
" (Marker = " <<Marker_Tag<<
")." << endl;
10318 if (duplicate) cout <<
nElem_Bound[iMarker+1] <<
" boundary elements in index "<< iMarker+1 <<
" (Marker = " <<Marker_Tag_Duplicate<<
")." << endl;
10328 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
10329 getline(mesh_file, text_line);
10330 istringstream bound_line(text_line);
10331 bound_line >> VTK_Type;
10339 bound_line >> vnodes_edge[0]; bound_line >> vnodes_edge[1];
10340 bound[iMarker][ielem] =
new CLine(vnodes_edge[0], vnodes_edge[1],2);
10343 if (ActDisk_Bool[vnodes_edge[0]]) { vnodes_edge[0] = ActDiskPoint_Back[vnodes_edge[0]]; }
10344 if (ActDisk_Bool[vnodes_edge[1]]) { vnodes_edge[1] = ActDiskPoint_Back[vnodes_edge[1]]; }
10345 bound[iMarker+1][ielem] =
new CLine(vnodes_edge[0], vnodes_edge[1],2);
10351 bound_line >> vnodes_triangle[0]; bound_line >> vnodes_triangle[1]; bound_line >> vnodes_triangle[2];
10352 bound[iMarker][ielem] =
new CTriangle(vnodes_triangle[0], vnodes_triangle[1], vnodes_triangle[2],3);
10355 if (ActDisk_Bool[vnodes_triangle[0]]) { vnodes_triangle[0] = ActDiskPoint_Back[vnodes_triangle[0]]; }
10356 if (ActDisk_Bool[vnodes_triangle[1]]) { vnodes_triangle[1] = ActDiskPoint_Back[vnodes_triangle[1]]; }
10357 if (ActDisk_Bool[vnodes_triangle[2]]) { vnodes_triangle[2] = ActDiskPoint_Back[vnodes_triangle[2]]; }
10358 bound[iMarker+1][ielem] =
new CTriangle(vnodes_triangle[0], vnodes_triangle[1], vnodes_triangle[2],3);
10366 bound_line >> vnodes_quad[0]; bound_line >> vnodes_quad[1]; bound_line >> vnodes_quad[2]; bound_line >> vnodes_quad[3];
10368 bound[iMarker][ielem] =
new CQuadrilateral(vnodes_quad[0], vnodes_quad[1], vnodes_quad[2], vnodes_quad[3],3);
10371 if (ActDisk_Bool[vnodes_quad[0]]) { vnodes_quad[0] = ActDiskPoint_Back[vnodes_quad[0]]; }
10372 if (ActDisk_Bool[vnodes_quad[1]]) { vnodes_quad[1] = ActDiskPoint_Back[vnodes_quad[1]]; }
10373 if (ActDisk_Bool[vnodes_quad[2]]) { vnodes_quad[2] = ActDiskPoint_Back[vnodes_quad[2]]; }
10374 if (ActDisk_Bool[vnodes_quad[3]]) { vnodes_quad[3] = ActDiskPoint_Back[vnodes_quad[3]]; }
10375 bound[iMarker+1][ielem] =
new CQuadrilateral(vnodes_quad[0], vnodes_quad[1], vnodes_quad[2], vnodes_quad[3],3);
10422 boundary_marker_count++;
10433 unsigned long nelem_vertex = 0, vnodes_vertex;
10434 unsigned short transform;
10435 getline (mesh_file, text_line);
10436 text_line.erase (0,13);
nElem_Bound[iMarker] = atoi(text_line.c_str());
10439 nelem_vertex = 0; ielem = 0;
10440 getline (mesh_file, text_line); text_line.erase (0,8);
10444 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
10445 getline(mesh_file, text_line);
10446 istringstream bound_line(text_line);
10447 bound_line >> VTK_Type; bound_line >> vnodes_vertex; bound_line >> transform;
10451 ielem++; nelem_vertex++;
10456 boundary_marker_count++;
10461 if (boundary_marker_count ==
nMarker)
break;
10466 while (getline (mesh_file, text_line) && (found_transform ==
false)) {
10470 position = text_line.find (
"NPERIODIC=",0);
10471 if (position != string::npos) {
10472 unsigned short nPeriodic, iPeriodic, iIndex;
10475 found_transform =
true;
10478 text_line.erase (0,10); nPeriodic = atoi(text_line.c_str());
10480 if (nPeriodic - 1 != 0)
10481 cout << nPeriodic - 1 <<
" periodic transformations." << endl;
10486 for (iPeriodic = 0; iPeriodic < nPeriodic; iPeriodic++) {
10487 getline (mesh_file, text_line);
10488 position = text_line.find (
"PERIODIC_INDEX=",0);
10489 if (position != string::npos) {
10490 text_line.erase (0,15); iIndex = atoi(text_line.c_str());
10491 if (iIndex != iPeriodic) {
10498 getline (mesh_file, text_line);
10499 istringstream cent(text_line);
10500 cent >> center[0]; cent >> center[1]; cent >> center[2];
10502 getline (mesh_file, text_line);
10503 istringstream rot(text_line);
10504 rot >> rotation[0]; rot >> rotation[1]; rot >> rotation[2];
10506 getline (mesh_file, text_line);
10507 istringstream tran(text_line);
10508 tran >> translate[0]; tran >> translate[1]; tran >> translate[2];
10511 delete [] center;
delete [] rotation;
delete [] translate;
10518 if (!found_transform) {
10519 unsigned short nPeriodic = 1, iPeriodic = 0;
10524 for (
unsigned short iDim = 0; iDim < 3; iDim++) {
10525 center[iDim] = 0.0; rotation[iDim] = 0.0; translate[iDim] = 0.0;
10530 delete [] center;
delete [] rotation;
delete [] translate;
10539 if (actuator_disk) {
10540 delete [] ActDisk_Bool;
10541 delete [] ActDiskPoint_Back;
10542 delete [] VolumePoint_Inv;
10543 delete [] CoordXVolumePoint;
10544 delete [] CoordYVolumePoint;
10545 delete [] CoordZVolumePoint;
10546 delete [] CoordXActDisk;
10547 delete [] CoordYActDisk;
10548 delete [] CoordZActDisk;
10562 string text_line, Marker_Tag;
10563 ifstream mesh_file;
10564 unsigned short VTK_Type = 0, iMarker = 0;
10566 unsigned long iPoint = 0, iProcessor = 0, ielem = 0, GlobalIndex = 0;
10567 unsigned long globalOffset = 0;
10572 unsigned long vnodes_cgns[8] = {0,0,0,0,0,0,0,0};
10573 su2double Coord_cgns[3] = {0.0,0.0,0.0};
10574 int fn, nbases = 0, nzones = 0, ngrids = 0, ncoords = 0, nsections = 0;
10575 int *vertices = NULL, *cells = NULL, nMarkers = 0, *boundVerts = NULL, npe;
10576 int interiorElems = 0, totalVerts = 0;
10577 int cell_dim = 0, phys_dim = 0, nbndry, parent_flag, file_type;
10580 cgsize_t* cgsize; cgsize =
new cgsize_t[3];
10581 ZoneType_t zonetype;
10582 DataType_t datatype;
10585 ElementType_t elemType;
10586 cgsize_t range_min, range_max, startE, endE;
10588 string currentElem;
10589 int** elemTypeVTK = NULL;
10590 int** elemIndex = NULL;
10591 int** elemBegin = NULL;
10592 int** elemEnd = NULL;
10593 int** nElems = NULL;
10594 cgsize_t**** connElems = NULL;
10595 cgsize_t* connElemCGNS = NULL;
10596 cgsize_t* connElemTemp = NULL;
10597 cgsize_t ElementDataSize = 0;
10598 cgsize_t* parentData = NULL;
10599 int** dataSize = NULL;
10600 bool** isInternal = NULL;
10601 char*** sectionNames = NULL;
10606 unsigned long Local_nElem;
10607 unsigned long Local_nElemTri, Local_nElemQuad, Local_nElemTet;
10608 unsigned long Local_nElemHex, Local_nElemPrism, Local_nElemPyramid;
10627 unsigned long total_pt_accounted = 0;
10628 unsigned long rem_points = 0;
10629 unsigned long element_count = 0;
10630 unsigned long element_remainder = 0;
10631 unsigned long total_elems = 0;
10641 unsigned long *nElem_Linear =
new unsigned long[
size];
10643 unsigned long *elemB =
new unsigned long[
size];
10644 unsigned long *elemE =
new unsigned long[
size];
10646 unsigned long *elemGlobalID = NULL;
10648 unsigned short *nPoinPerElem = NULL;
10649 unsigned short *elemTypes = NULL;
10651 bool *isMixed = NULL;
10653 unsigned short connSize = 10;
10656 if (cg_is_cgns(val_mesh_filename.c_str(), &file_type) != CG_OK) {
10664 if (cg_open(val_mesh_filename.c_str(), CG_MODE_READ, &fn)) cg_error_exit();
10666 cout <<
"Reading the CGNS file: ";
10667 cout << val_mesh_filename.c_str() <<
"." << endl;
10673 if ( cg_nbases(fn, &nbases) ) cg_error_exit();
10675 cout <<
"CGNS file contains " << nbases <<
" database(s)." << endl;
10681 if ( nbases > 1 ) {
10687 for (
int i = 1; i <= nbases; i++) {
10689 if (cg_base_read(fn, i, basename, &cell_dim, &phys_dim)) cg_error_exit();
10693 if ( cg_nzones(fn, i, &nzones) ) cg_error_exit();
10695 cout <<
"Database " << i <<
", " << basename <<
": " << nzones;
10696 cout <<
" zone(s), cell dimension of " << cell_dim <<
", physical ";
10697 cout <<
"dimension of " << phys_dim <<
"." << endl;
10704 if ( nzones > 1 ) {
10710 vertices =
new int[nzones];
10711 cells =
new int[nzones];
10712 boundVerts =
new int[nzones];
10715 elemTypeVTK =
new int*[nzones];
10716 elemIndex =
new int*[nzones];
10717 elemBegin =
new int*[nzones];
10718 elemEnd =
new int*[nzones];
10719 nElems =
new int*[nzones];
10720 dataSize =
new int*[nzones];
10721 isInternal =
new bool*[nzones];
10723 sectionNames =
new char**[nzones];
10724 connElems =
new cgsize_t***[nzones];
10728 for (
int j = 1; j <= nzones; j++) {
10730 connElems[j-1] = NULL;
10736 if (cg_zone_read(fn, i, j, zonename, cgsize)) cg_error_exit();
10743 vertices[j-1] = cgsize[0];
10744 cells[j-1] = cgsize[1];
10745 boundVerts[j-1] = cgsize[2];
10755 totalVerts += vertices[j-1];
10759 if (cg_zone_type(fn, i, j, &zonetype)) cg_error_exit();
10761 cout <<
"Zone " << j <<
", " << zonename <<
": " << vertices[j-1];
10762 cout <<
" vertices, " << cells[j-1] <<
" cells, " << boundVerts[j-1];
10763 cout <<
" boundary vertices." << endl;
10770 if (cg_ngrids(fn, i, j, &ngrids)) cg_error_exit();
10778 if (cg_ncoords( fn, i, j, &ncoords)) cg_error_exit();
10780 cout <<
"Reading grid coordinates." << endl;
10781 cout <<
"Number of coordinate dimensions is " << ncoords <<
"." << endl;
10788 total_pt_accounted = 0;
10789 for (
int ii = 0; ii <
size; ii++) {
10791 total_pt_accounted = total_pt_accounted +
npoint_procs[ii];
10796 rem_points = vertices[j-1]-total_pt_accounted;
10797 for (
unsigned long ii = 0; ii < rem_points; ii++) {
10807 for (
int ii = 1; ii <
size; ii++) {
10827 for (
int ii = 0; ii < ncoords; ii++) {
10834 for (
int k = 1; k <= ncoords; k++) {
10842 if (cg_coord_info(fn, i, j, k, &datatype, coordname))
10845 cout <<
"Loading " << coordname;
10847 cout <<
" values into linear partitions." << endl;
10849 cout <<
" values." << endl;
10855 if (datatype != RealDouble) {
10858 if ( cg_coord_read(fn, i, j, coordname, datatype, &range_min,
10859 &range_max, coordArray[j-1]) ) cg_error_exit();
10864 for (
unsigned long m = 0; m <
nPoint; m++ ) {
10865 gridCoords[j-1][k-1][m] = coordArray[j-1][m];
10873 cout <<
"Distributing connectivity across all ranks." << endl;
10877 if ( cg_nsections(fn, i, j, &nsections) ) cg_error_exit();
10879 cout <<
"Number of connectivity sections is ";
10880 cout << nsections <<
"." << endl;
10888 elemTypeVTK[j-1] =
new int[nsections];
10889 elemIndex[j-1] =
new int[nsections];
10890 elemBegin[j-1] =
new int[nsections];
10891 elemEnd[j-1] =
new int[nsections];
10892 nElems[j-1] =
new int[nsections];
10893 dataSize[j-1] =
new int[nsections];
10894 isInternal[j-1] =
new bool[nsections];
10896 sectionNames[j-1] =
new char*[nsections];
10897 for (
int ii = 0; ii < nsections; ii++) {
10901 connElems[j-1] =
new cgsize_t**[nsections];
10907 for (
int s = 1; s <= nsections; s++) {
10909 connElems[j-1][s-1] = NULL;
10914 if (cg_section_read(fn, i, j, s, sectionNames[j-1][s-1],
10915 &elemType, &startE, &endE, &nbndry,
10916 &parent_flag)) cg_error_exit();
10920 elemBegin[j-1][s-1] = (int)startE;
10921 elemEnd[j-1][s-1] = (int)endE;
10925 element_count = (int) (endE-startE+1);
10927 for (
int ii = 0; ii <
size; ii++) {
10928 nElem_Linear[ii] = element_count/
size;
10929 total_elems += nElem_Linear[ii];
10934 element_remainder = element_count-total_elems;
10935 for (
unsigned long ii = 0; ii < element_remainder; ii++) {
10936 nElem_Linear[ii]++;
10942 nElems[j-1][s-1] = (int)nElem_Linear[
rank];
10947 elemE[0] = startE + nElem_Linear[0] - 1;
10948 for (
unsigned long ii = 1; ii < (
unsigned long)
size; ii++) {
10949 elemB[ii] = elemE[ii-1]+1;
10950 elemE[ii] = elemB[ii] + nElem_Linear[ii] - 1;
10956 connElemCGNS =
new cgsize_t[nElems[j-1][s-1]*connSize];
10957 nPoinPerElem =
new unsigned short[nElems[j-1][s-1]];
10958 elemGlobalID =
new unsigned long[nElems[j-1][s-1]];
10959 elemTypes =
new unsigned short[nElems[j-1][s-1]];
10961 isMixed =
new bool[nElems[j-1][s-1]];
10962 for (
int ii = 0; ii < nElems[j-1][s-1]; ii++ ) isMixed[ii] =
false;
10970 if (nElems[j-1][s-1] <
rank+1) {
10972 isInternal[j-1][s-1] =
false;
10980 if (cg_elements_partial_read(fn, i, j, s, (cgsize_t)elemB[
rank],
10981 (cgsize_t)elemE[
rank], connElemCGNS,
10982 parentData) != CG_OK) cg_error_exit();
10987 ElementType_t elmt_type;
10988 if (cg_npe(elemType, &npe)) cg_error_exit();
10994 for (
int ii = 0; ii < nElems[j-1][s-1]; ii++ ) {
10999 if (elemType == MIXED) {
11000 elmt_type = ElementType_t(connElemCGNS[counter]);
11001 cg_npe(elmt_type, &npe);
11002 counter++;
for (
int jj = 0; jj < npe; jj++ ) counter++;
11003 isMixed[ii] =
true;
11005 elmt_type = elemType;
11010 nPoinPerElem[ii] = npe;
11018 elemGlobalID[ii] = elemB[
rank] + ii - 1 - globalOffset;
11024 char buf1[100], buf2[100], buf3[100];
11026 switch (elmt_type) {
11028 currentElem =
"Vertex";
11032 currentElem =
"Line";
11036 currentElem =
"Line";
11040 currentElem =
"Triangle";
11044 currentElem =
"Quadrilateral";
11048 currentElem =
"Tetrahedron";
11049 elemTypes[ii] = 10;
11052 currentElem =
"Hexahedron";
11053 elemTypes[ii] = 12;
11056 currentElem =
"Prism";
11057 elemTypes[ii] = 13;
11060 currentElem =
"Pyramid";
11061 elemTypes[ii] = 14;
11064 SPRINTF(buf1,
"Section %d, npe=%d\n", s, npe);
11065 SPRINTF(buf2,
"startE %d, endE %d", (
int)startE, (
int)endE);
11070 SPRINTF(buf1,
"Unknown elem: (type %d, npe=%d)\n", elemType, npe);
11071 SPRINTF(buf2,
"Section %d\n", s);
11072 SPRINTF(buf3,
"startE %d, endE %d", (
int)startE, (
int)endE);
11085 if ( cell_dim == 2 ) {
11089 if (elemTypes[ii] == 3) {
11090 isInternal[j-1][s-1] =
false;
11092 isInternal[j-1][s-1] =
true;
11096 }
else if (cell_dim == 3) {
11100 switch (elemTypes[ii]) {
11103 isInternal[j-1][s-1] =
false;
11106 isInternal[j-1][s-1] =
true;
11117 for (
int ii = 0; ii < nElems[j-1][s-1]; ii++ )
11118 if (isMixed[ii]) {currentElem =
"Mixed";
break;}
11119 cout <<
"Loading section " << sectionNames[j-1][s-1];
11120 cout <<
" of element type " << currentElem <<
"." << endl;
11130 if (!isInternal[j-1][s-1]) {
11136 delete [] connElemCGNS;
11137 delete [] nPoinPerElem;
11138 delete [] elemTypes;
11139 delete [] elemGlobalID;
11145 globalOffset += element_count;
11155 if ( cg_section_read(fn, i, j, s, sectionNames[j-1][s-1],
11156 &elemType, &startE, &endE, &nbndry,
11157 &parent_flag) ) cg_error_exit();
11161 nElems[j-1][s-1] = (int) (endE-startE+1);
11166 if (cg_ElementDataSize(fn, i, j, s, &ElementDataSize))
11168 dataSize[j-1][s-1] = ElementDataSize;
11173 if (cg_npe(elemType, &npe)) cg_error_exit();
11174 elemIndex[j-1][s-1] = npe;
11180 char buf1[100], buf2[100], buf3[100];
11182 switch (elemType) {
11184 elemTypeVTK[j-1][s-1] = 1;
11187 elemTypeVTK[j-1][s-1] = 3;
11190 elemTypeVTK[j-1][s-1] = 3;
11193 elemTypeVTK[j-1][s-1] = 5;
11196 elemTypeVTK[j-1][s-1] = 9;
11199 elemTypeVTK[j-1][s-1] = 10;
11202 elemTypeVTK[j-1][s-1] = 12;
11205 elemTypeVTK[j-1][s-1] = 13;
11208 elemTypeVTK[j-1][s-1] = 14;
11211 SPRINTF(buf1,
"Section %d, npe=%d\n", s, npe);
11212 SPRINTF(buf2,
"startE %d, endE %d", (
int)startE, (
int)endE);
11217 currentElem =
"Mixed";
11218 elemTypeVTK[j-1][s-1] = -1;
11221 SPRINTF(buf1,
"Unknown elem: (type %d, npe=%d)\n", elemType, npe);
11222 SPRINTF(buf2,
"Section %d\n", s);
11223 SPRINTF(buf3,
"startE %d, endE %d", (
int)startE, (
int)endE);
11231 if (elemTypeVTK[j-1][s-1] == -1) elemIndex[j-1][s-1] = 9;
11236 connElemTemp =
new cgsize_t[dataSize[j-1][s-1]];
11237 connElems[j-1][s-1] =
new cgsize_t*[elemIndex[j-1][s-1]];
11238 for (
int jj = 0; jj < elemIndex[j-1][s-1]; jj++) {
11239 connElems[j-1][s-1][jj] =
new cgsize_t[nElems[j-1][s-1]];
11244 if (cg_elements_read(fn, i, j, s, connElemTemp, parentData))
11250 if (elemTypeVTK[j-1][s-1] == -1) {
11252 for (
int ii = 0; ii < nElems[j-1][s-1]; ii++ ) {
11253 ElementType_t elmt_type = ElementType_t(connElemTemp[counter]);
11254 cg_npe( elmt_type, &npe);
11256 connElems[j-1][s-1][0][ii] = elmt_type;
11257 for (
int jj = 0; jj < npe; jj++ ) {
11258 connElems[j-1][s-1][jj+1][ii] = connElemTemp[counter] - 1;
11264 for (
int ii = 0; ii < nElems[j-1][s-1]; ii++ ) {
11265 for (
int jj = 0; jj < elemIndex[j-1][s-1]; jj++ ) {
11266 connElems[j-1][s-1][jj][ii] = connElemTemp[counter] - 1;
11271 delete[] connElemTemp;
11279 connElemTemp =
new cgsize_t[nElems[j-1][s-1]*connSize];
11284 int counterTemp = 0, counterCGNS = 0;
11285 for (
int ii = 0; ii < nElems[j-1][s-1]; ii++ ) {
11289 counterTemp = ii*connSize;
11295 if (isMixed[ii]) counterCGNS++;
11296 for (
int jj = 0; jj < nPoinPerElem[ii]; jj++) {
11297 connElemTemp[counterTemp] = connElemCGNS[counterCGNS + jj] - 1;
11300 counterCGNS += nPoinPerElem[ii];
11306 delete [] connElemCGNS;
11316 int *nElem_Send =
new int[
size+1]; nElem_Send[0] = 0;
11317 int *nElem_Recv =
new int[
size+1]; nElem_Recv[0] = 0;
11318 int *nElem_Flag =
new int[
size];
11320 for (
int ii=0; ii <
size; ii++) {
11321 nElem_Send[ii] = 0;
11322 nElem_Recv[ii] = 0;
11323 nElem_Flag[ii]= -1;
11325 nElem_Send[
size] = 0; nElem_Recv[
size] = 0;
11327 for (
int ii = 0; ii < nElems[j-1][s-1]; ii++ ) {
11328 for (
int jj = 0; jj < nPoinPerElem[ii]; jj++ ) {
11332 iPoint = connElemTemp[ii*connSize + jj];
11337 if (iProcessor >= (
unsigned long)
size)
11338 iProcessor = (
unsigned long)
size-1;
11347 if (nElem_Flag[iProcessor] != ii) {
11348 nElem_Flag[iProcessor] = ii;
11349 nElem_Send[iProcessor+1]++;
11363 nElem_Recv[1] = nElem_Send[1];
11371 int nSends = 0, nRecvs = 0;
11372 for (
int ii=0; ii <
size; ii++) nElem_Flag[ii] = -1;
11374 for (
int ii = 0; ii <
size; ii++) {
11376 if ((ii !=
rank) && (nElem_Send[ii+1] > 0)) nSends++;
11377 if ((ii !=
rank) && (nElem_Recv[ii+1] > 0)) nRecvs++;
11379 nElem_Send[ii+1] += nElem_Send[ii];
11380 nElem_Recv[ii+1] += nElem_Recv[ii];
11388 unsigned long *connSend = NULL;
11389 connSend =
new unsigned long[connSize*nElem_Send[
size]];
11390 for (
int ii = 0; ii < connSize*nElem_Send[
size]; ii++)
11396 unsigned long *index =
new unsigned long[
size];
11397 for (
int ii=0; ii <
size; ii++) index[ii] = connSize*nElem_Send[ii];
11402 for (
int ii = 0; ii < nElems[j-1][s-1]; ii++ ) {
11403 for (
int jj = 0; jj < nPoinPerElem[ii]; jj++ ) {
11407 iPoint = connElemTemp[ii*connSize + jj];
11412 if (iProcessor >= (
unsigned long)
size) iProcessor = (
unsigned long)
size-1;
11420 if (nElem_Flag[iProcessor] != ii) {
11422 nElem_Flag[iProcessor] = ii;
11423 unsigned long nn = index[iProcessor];
11428 connSend[nn] = elemTypes[ii]; nn++;
11429 for (
int kk = 0; kk < nPoinPerElem[ii]; kk++ ) {
11430 connSend[nn] = connElemTemp[ii*connSize + kk]; nn++;
11432 connSend[nn] = (cgsize_t)elemGlobalID[ii];
11436 index[iProcessor] += connSize;
11444 delete [] connElemTemp;
11445 delete [] elemTypes;
11446 delete [] nPoinPerElem;
11447 delete [] elemGlobalID;
11455 unsigned long *connRecv = NULL;
11456 connRecv =
new unsigned long[connSize*nElem_Recv[
size]];
11457 for (
int ii = 0; ii < connSize*nElem_Recv[
size]; ii++)
11463 unsigned long iMessage = 0;
11464 for (
int ii=0; ii<
size; ii++) {
11465 if ((ii !=
rank) && (nElem_Recv[ii+1] > nElem_Recv[ii])) {
11466 int ll = connSize*nElem_Recv[ii];
11467 int kk = nElem_Recv[ii+1] - nElem_Recv[ii];
11468 int count = connSize*kk;
11480 for (
int ii=0; ii<
size; ii++) {
11481 if ((ii !=
rank) && (nElem_Send[ii+1] > nElem_Send[ii])) {
11482 int ll = connSize*nElem_Send[ii];
11483 int kk = nElem_Send[ii+1] - nElem_Send[ii];
11484 int count = connSize*kk;
11486 int tag =
rank + 1;
11496 int mm = connSize*nElem_Recv[
rank];
11497 int ll = connSize*nElem_Send[
rank];
11498 int kk = connSize*nElem_Send[
rank+1];
11500 for (
int nn=ll; nn<kk; nn++, mm++) connRecv[mm] = connSend[nn];
11505 int number = nSends;
11506 for (
int ii = 0; ii < nSends; ii++)
11510 for (
int ii = 0; ii < nRecvs; ii++)
11513 delete [] send_req;
11514 delete [] recv_req;
11521 connElems[j-1][s-1] =
new cgsize_t*[connSize];
11522 for (
int jj = 0; jj < connSize; jj++) {
11523 connElems[j-1][s-1][jj] =
new cgsize_t[nElem_Recv[
size]];
11525 for (
int ii = 0; ii < nElem_Recv[
size]; ii++) {
11526 for (
int jj = 0; jj < connSize; jj++) {
11527 connElems[j-1][s-1][jj][ii] = (cgsize_t)connRecv[ii*connSize+jj];
11534 nElems[j-1][s-1] = nElem_Recv[
size];
11538 delete [] connSend;
11539 delete [] connRecv;
11540 delete [] nElem_Recv;
11541 delete [] nElem_Send;
11542 delete [] nElem_Flag;
11554 if ( cg_close(fn) ) cg_error_exit();
11556 cout <<
"Successfully closed the CGNS file." << endl;
11561 cout << endl <<
"Loading CGNS data into SU2 data structures." << endl;
11567 if (
nDim == 2) cout <<
"Two dimensional problem." << endl;
11568 if (
nDim == 3) cout <<
"Three dimensional problem." << endl;
11573 vector< vector<unsigned long> > adj_nodes(
nPoint, vector<unsigned long>(0));
11578 for (
int k = 0; k < nzones; k++) {
11579 for (
int s = 0; s < nsections; s++) {
11580 if (isInternal[k][s]) {
11581 for (
int i = 0; i < nElems[k][s]; i++) {
11592 Local_nElem = interiorElems;
11601 cout <<
Global_nElem <<
" interior elements before linear partitioning." << endl;
11603 cout <<
Global_nElem <<
" interior elements." << endl;
11614 unsigned long global_id = 0;
11618 for (
int k = 0; k < nzones; k++) {
11619 for (
int s = 0; s < nsections; s++) {
11620 if (isInternal[k][s]) {
11621 for (
int i = 0; i < nElems[k][s]; i++) {
11626 VTK_Type = connElems[k][s][0][i];
11635 vnodes_cgns[j] = connElems[k][s][j+1][i];
11648 elem[ielem] =
new CTriangle(vnodes_cgns[0], vnodes_cgns[1], vnodes_cgns[2],
nDim);
11655 vnodes_cgns[j] = connElems[k][s][j+1][i];
11664 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii+1)%4]);
11665 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii+3)%4]);
11678 vnodes_cgns[j] = connElems[k][s][j+1][i];
11691 elem[ielem] =
new CTetrahedron(vnodes_cgns[0], vnodes_cgns[1], vnodes_cgns[2], vnodes_cgns[3]);
11698 vnodes_cgns[j] = connElems[k][s][j+1][i];
11708 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii+1)%4]);
11709 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii+3)%4]);
11711 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii-3)%4+4]);
11712 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii-1)%4+4]);
11714 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii+4)%8]);
11720 elem[ielem] =
new CHexahedron(vnodes_cgns[0], vnodes_cgns[1], vnodes_cgns[2], vnodes_cgns[3], vnodes_cgns[4], vnodes_cgns[5], vnodes_cgns[6], vnodes_cgns[7]);
11727 vnodes_cgns[j] = connElems[k][s][j+1][i];
11737 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii+1)%3]);
11738 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii+2)%3]);
11740 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii-2)%3+3]);
11741 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii-1)%3+3]);
11743 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii+3)%6]);
11749 elem[ielem] =
new CPrism(vnodes_cgns[0], vnodes_cgns[1], vnodes_cgns[2], vnodes_cgns[3], vnodes_cgns[4], vnodes_cgns[5]);
11756 vnodes_cgns[j] = connElems[k][s][j+1][i];
11766 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii+1)%4]);
11767 adj_nodes[vnodes_cgns[ii]-
starting_node[
rank]].push_back(vnodes_cgns[(ii+3)%4]);
11780 elem[ielem] =
new CPyramid(vnodes_cgns[0], vnodes_cgns[1], vnodes_cgns[2], vnodes_cgns[3], vnodes_cgns[4]);
11822 #ifdef HAVE_PARMETIS
11829 cout <<
"Building the graph adjacency structure." << endl;
11831 unsigned long loc_adjc_size=0;
11832 vector<unsigned long> adjac_vec;
11833 unsigned long adj_elem_size;
11834 vector<unsigned long>::iterator it;
11838 vector<unsigned long> temp_adjacency;
11839 unsigned long local_count=0;
11841 for (
unsigned long i = 0; i <
nPoint; i++) {
11843 for (
unsigned long j=0; j<adj_nodes[i].size(); j++) {
11844 temp_adjacency.push_back(adj_nodes[i][j]);
11847 sort(temp_adjacency.begin(), temp_adjacency.end());
11848 it = unique( temp_adjacency.begin(), temp_adjacency.end());
11849 loc_adjc_size=it - temp_adjacency.begin();
11851 temp_adjacency.resize( loc_adjc_size);
11852 xadj[local_count+1]=xadj[local_count]+loc_adjc_size;
11855 for (
unsigned long j=0; j<loc_adjc_size; j++) {
11856 adjac_vec.push_back(temp_adjacency[j]);
11858 temp_adjacency.clear();
11859 adj_nodes[i].clear();
11865 adjacency =
new idx_t [adj_elem_size];
11866 copy(adjac_vec.begin(), adjac_vec.end(), adjacency);
11883 cout <<
Global_nPoint <<
" grid points before linear partitioning." << endl;
11892 for (
int k = 0; k < nzones; k++ ) {
11893 for (
unsigned long i = 0; i <
nPoint; i++ ) {
11894 for (
int j = 0; j < cell_dim; j++ ) Coord_cgns[j] = gridCoords[k][j][i];
11897 node[iPoint] =
new CPoint(Coord_cgns[0], Coord_cgns[1], GlobalIndex, config);
11900 node[iPoint] =
new CPoint(Coord_cgns[0], Coord_cgns[1], Coord_cgns[2], GlobalIndex, config);
11914 cout <<
nMarker <<
" surface markers." << endl;
11921 for (
int k = 0; k < nzones; k ++ ) {
11922 for (
int s = 0; s < nsections; s++ ) {
11923 if ( !isInternal[k][s] ) {
11930 Marker_Tag = sectionNames[k][s];
11933 Marker_Tag.erase(remove(Marker_Tag.begin(), Marker_Tag.end(),
' '), Marker_Tag.end());
11935 if (Marker_Tag !=
"SEND_RECEIVE") {
11938 cout <<
nElem_Bound[iMarker] <<
" boundary elements in index ";
11939 cout << iMarker <<
" (Marker = " <<Marker_Tag<<
")." << endl;
11943 for (
int i = 0; i < nElems[k][s]; i++ ) {
11948 if (elemTypeVTK[k][s] == -1 ) {
11952 ElementType_t elmt_type = ElementType_t(connElems[k][s][0][i]);
11953 cg_npe( elmt_type, &npe);
11955 switch (elmt_type) {
11956 case NODE: VTK_Type = 1;
break;
11957 case BAR_2: VTK_Type = 3;
break;
11958 case BAR_3: VTK_Type = 3;
break;
11959 case TRI_3: VTK_Type = 5;
break;
11960 case QUAD_4: VTK_Type = 9;
break;
11961 case TETRA_4: VTK_Type = 10;
break;
11962 case HEXA_8: VTK_Type = 12;
break;
11963 case PENTA_6: VTK_Type = 13;
break;
11964 case PYRA_5: VTK_Type = 14;
break;
11972 for (
int j = 1; j < npe+1; j++ ) {
11973 vnodes_cgns[j-1] = connElems[k][s][j][i];
11980 VTK_Type = elemTypeVTK[k][s];
11984 for (
int j = 0; j < elemIndex[k][s]; j++ ) {
11985 vnodes_cgns[j] = connElems[k][s][j][i];
11997 bound[iMarker][ielem] =
new CLine(vnodes_cgns[0], vnodes_cgns[1],2);
12000 bound[iMarker][ielem] =
new CTriangle(vnodes_cgns[0], vnodes_cgns[1], vnodes_cgns[2],3);
12003 bound[iMarker][ielem] =
new CQuadrilateral(vnodes_cgns[0], vnodes_cgns[1], vnodes_cgns[2], vnodes_cgns[3],3);
12039 unsigned short nPeriodic = 1, iPeriodic = 0;
12044 for (
unsigned short iDim = 0; iDim < 3; iDim++) {
12045 center[iDim] = 0.0; rotation[iDim] = 0.0; translate[iDim] = 0.0;
12050 delete [] center;
delete [] rotation;
delete [] translate;
12056 delete[] boundVerts;
12058 for (
int kk = 0; kk < nzones; kk++) {
12059 for (
int ii = 0; ii < nsections; ii++) {
12060 if (isInternal[kk][ii]) {
12061 for (
int jj = 0; jj < connSize; jj++) {
12062 if (connElems[kk][ii][jj] != NULL)
delete [] connElems[kk][ii][jj];
12064 if (connElems[kk][ii] != NULL)
delete [] connElems[kk][ii];
12066 for (
int jj = 0; jj < elemIndex[kk][ii]; jj++) {
12067 if (connElems[kk][ii][jj] != NULL)
delete [] connElems[kk][ii][jj];
12069 if (connElems[kk][ii] != NULL)
delete [] connElems[kk][ii];
12072 if (connElems[kk] != NULL)
delete [] connElems[kk];
12074 if (connElems != NULL)
delete[] connElems;
12076 for (
int j = 0; j < nzones; j++) {
12077 delete [] coordArray[j];
12078 delete [] elemTypeVTK[j];
12079 delete [] elemIndex[j];
12080 delete [] nElems[j];
12081 delete [] dataSize[j];
12082 delete [] isInternal[j];
12083 delete [] elemBegin[j];
12084 delete [] elemEnd[j];
12085 for (
int ii = 0; ii < nsections; ii++) {
12086 delete[] sectionNames[j][ii];
12088 delete[] sectionNames[j];
12091 delete [] coordArray;
12092 delete [] elemTypeVTK;
12093 delete [] elemIndex;
12095 delete [] dataSize;
12096 delete [] isInternal;
12097 delete [] sectionNames;
12098 delete [] elemBegin;
12101 for (
int j = 0; j < nzones; j++) {
12102 for (
int i = 0; i < ncoords; i++ ) {
12103 delete [] gridCoords[j][i];
12105 delete [] gridCoords[j];
12107 delete [] gridCoords;
12109 delete [] nElem_Linear;
12118 string(
"To use CGNS, remove the -DNO_CGNS directive ") +
12119 string(
"from the makefile and supply the correct path ") +
12127 unsigned long Point_1, Point_2, Point_3, Point_4, Point_5, Point_6,
12128 iElem, triangle_flip = 0, quad_flip = 0, tet_flip = 0, prism_flip = 0,
12129 hexa_flip = 0, pyram_flip = 0;
12130 su2double test_1, test_2, test_3, test_4, *Coord_1, *Coord_2, *Coord_3, *Coord_4,
12131 *Coord_5, *Coord_6, a[3] = {0.0,0.0,0.0}, b[3] = {0.0,0.0,0.0}, c[3] = {0.0,0.0,0.0}, n[3] = {0.0,0.0,0.0}, test;
12132 unsigned short iDim;
12136 for (iElem = 0; iElem <
nElem; iElem++) {
12146 for (iDim = 0; iDim <
nDim; iDim++) {
12147 a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
12148 b[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]); }
12149 test = a[0]*b[1]-b[0]*a[1];
12166 for (iDim = 0; iDim <
nDim; iDim++) {
12167 a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
12168 b[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]); }
12169 test_1 = a[0]*b[1]-b[0]*a[1];
12171 for (iDim = 0; iDim <
nDim; iDim++) {
12172 a[iDim] = 0.5*(Coord_3[iDim]-Coord_2[iDim]);
12173 b[iDim] = 0.5*(Coord_4[iDim]-Coord_2[iDim]); }
12174 test_2 = a[0]*b[1]-b[0]*a[1];
12176 for (iDim = 0; iDim <
nDim; iDim++) {
12177 a[iDim] = 0.5*(Coord_4[iDim]-Coord_3[iDim]);
12178 b[iDim] = 0.5*(Coord_1[iDim]-Coord_3[iDim]); }
12179 test_3 = a[0]*b[1]-b[0]*a[1];
12181 for (iDim = 0; iDim <
nDim; iDim++) {
12182 a[iDim] = 0.5*(Coord_1[iDim]-Coord_4[iDim]);
12183 b[iDim] = 0.5*(Coord_3[iDim]-Coord_4[iDim]); }
12184 test_4 = a[0]*b[1]-b[0]*a[1];
12186 if ((test_1 < 0.0) && (test_2 < 0.0) && (test_3 < 0.0) && (test_4 < 0.0)) {
12201 for (iDim = 0; iDim <
nDim; iDim++) {
12202 a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
12203 b[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]);
12204 c[iDim] = Coord_4[iDim]-Coord_1[iDim]; }
12205 n[0] = a[1]*b[2]-b[1]*a[2];
12206 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12207 n[2] = a[0]*b[1]-b[0]*a[1];
12209 test = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12219 if (
elem[iElem]->GetVTK_Type() ==
PRISM) {
12228 for (iDim = 0; iDim <
nDim; iDim++) {
12229 a[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]);
12230 b[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
12231 c[iDim] = (Coord_4[iDim]-Coord_1[iDim])+
12232 (Coord_5[iDim]-Coord_2[iDim])+
12233 (Coord_6[iDim]-Coord_3[iDim]); }
12237 n[0] = a[1]*b[2]-b[1]*a[2];
12238 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12239 n[2] = a[0]*b[1]-b[0]*a[1];
12241 test_1 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12243 for (iDim = 0; iDim <
nDim; iDim++) {
12244 a[iDim] = 0.5*(Coord_5[iDim]-Coord_4[iDim]);
12245 b[iDim] = 0.5*(Coord_6[iDim]-Coord_4[iDim]);
12246 c[iDim] = (Coord_1[iDim]-Coord_4[iDim])+
12247 (Coord_2[iDim]-Coord_5[iDim])+
12248 (Coord_3[iDim]-Coord_6[iDim]); }
12252 n[0] = a[1]*b[2]-b[1]*a[2];
12253 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12254 n[2] = a[0]*b[1]-b[0]*a[1];
12256 test_2 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12258 if ((test_1 < 0.0) || (test_2 < 0.0)) {
12272 for (iDim = 0; iDim <
nDim; iDim++) {
12273 a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
12274 b[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]);
12275 c[iDim] = Coord_4[iDim]-Coord_1[iDim]; }
12276 n[0] = a[1]*b[2]-b[1]*a[2];
12277 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12278 n[2] = a[0]*b[1]-b[0]*a[1];
12280 test_1 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12287 for (iDim = 0; iDim <
nDim; iDim++) {
12288 a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
12289 b[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]);
12290 c[iDim] = Coord_4[iDim]-Coord_1[iDim]; }
12291 n[0] = a[1]*b[2]-b[1]*a[2];
12292 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12293 n[2] = a[0]*b[1]-b[0]*a[1];
12295 test_2 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12302 for (iDim = 0; iDim <
nDim; iDim++) {
12303 a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
12304 b[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]);
12305 c[iDim] = Coord_4[iDim]-Coord_1[iDim]; }
12306 n[0] = a[1]*b[2]-b[1]*a[2];
12307 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12308 n[2] = a[0]*b[1]-b[0]*a[1];
12310 test_3 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12317 for (iDim = 0; iDim <
nDim; iDim++) {
12318 a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
12319 b[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]);
12320 c[iDim] = Coord_4[iDim]-Coord_1[iDim]; }
12321 n[0] = a[1]*b[2]-b[1]*a[2];
12322 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12323 n[2] = a[0]*b[1]-b[0]*a[1];
12325 test_4 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12327 if ((test_1 < 0.0) || (test_2 < 0.0) || (test_3 < 0.0)
12328 || (test_4 < 0.0)) {
12342 for (iDim = 0; iDim <
nDim; iDim++) {
12343 a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
12344 b[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]);
12345 c[iDim] = Coord_4[iDim]-Coord_1[iDim]; }
12346 n[0] = a[1]*b[2]-b[1]*a[2];
12347 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12348 n[2] = a[0]*b[1]-b[0]*a[1];
12350 test_1 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12357 for (iDim = 0; iDim <
nDim; iDim++) {
12358 a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
12359 b[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]);
12360 c[iDim] = Coord_4[iDim]-Coord_1[iDim]; }
12361 n[0] = a[1]*b[2]-b[1]*a[2];
12362 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12363 n[2] = a[0]*b[1]-b[0]*a[1];
12365 test_2 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12367 if ((test_1 < 0.0) || (test_2 < 0.0)) {
12377 unsigned long Mytriangle_flip = triangle_flip;
12378 unsigned long Myquad_flip = quad_flip;
12379 unsigned long Mytet_flip = tet_flip;
12380 unsigned long Myprism_flip = prism_flip;
12381 unsigned long Myhexa_flip = hexa_flip;
12382 unsigned long Mypyram_flip = pyram_flip;
12393 if (triangle_flip > 0) cout <<
"There has been a re-orientation of the TRIANGLE volume elements." << endl;
12394 if (quad_flip > 0) cout <<
"There has been a re-orientation of the QUADRILATERAL volume elements." << endl;
12395 if (tet_flip > 0) cout <<
"There has been a re-orientation of the TETRAHEDRON volume elements." << endl;
12396 if (prism_flip > 0) cout <<
"There has been a re-orientation of the PRISM volume elements." << endl;
12397 if (hexa_flip > 0) cout <<
"There has been a re-orientation of the HEXAHEDRON volume elements." << endl;
12398 if (pyram_flip > 0) cout <<
"There has been a re-orientation of the PYRAMID volume elements." << endl;
12405 unsigned long Point_1_Surface, Point_2_Surface, Point_3_Surface, Point_4_Surface,
12406 iElem_Domain, Point_Domain = 0, Point_Surface, iElem_Surface,
12407 line_flip = 0, triangle_flip = 0, quad_flip = 0;
12408 su2double test_1, test_2, test_3, test_4, *Coord_1, *Coord_2, *Coord_3, *Coord_4,
12409 *Coord_5, a[3] = {0.0,0.0,0.0}, b[3] = {0.0,0.0,0.0}, c[3] = {0.0,0.0,0.0}, n[3] = {0.0,0.0,0.0}, test;
12410 unsigned short iDim, iMarker, iNode_Domain, iNode_Surface;
12413 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
12417 for (iElem_Surface = 0; iElem_Surface <
nElem_Bound[iMarker]; iElem_Surface++) {
12420 for (iNode_Domain = 0; iNode_Domain <
elem[iElem_Domain]->
GetnNodes(); iNode_Domain++) {
12421 Point_Domain =
elem[iElem_Domain]->
GetNode(iNode_Domain);
12423 for (iNode_Surface = 0; iNode_Surface <
bound[iMarker][iElem_Surface]->
GetnNodes(); iNode_Surface++) {
12424 Point_Surface =
bound[iMarker][iElem_Surface]->
GetNode(iNode_Surface);
12425 if (Point_Surface == Point_Domain) {find =
true;
break;}
12432 if (
bound[iMarker][iElem_Surface]->GetVTK_Type() ==
LINE) {
12438 for (iDim = 0; iDim <
nDim; iDim++) {
12439 a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
12440 b[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]);
12442 test = a[0]*b[1]-b[0]*a[1];
12455 if (
bound[iMarker][iElem_Surface]->GetVTK_Type() ==
TRIANGLE) {
12462 for (iDim = 0; iDim <
nDim; iDim++) {
12463 a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
12464 b[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]);
12465 c[iDim] = Coord_4[iDim]-Coord_1[iDim];
12467 n[0] = a[1]*b[2]-b[1]*a[2];
12468 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12469 n[2] = a[0]*b[1]-b[0]*a[1];
12471 test = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12492 for (iDim = 0; iDim <
nDim; iDim++) {
12493 a[iDim] = 0.5*(Coord_2[iDim]-Coord_1[iDim]);
12494 b[iDim] = 0.5*(Coord_3[iDim]-Coord_1[iDim]);
12495 c[iDim] = Coord_5[iDim]-Coord_1[iDim];
12497 n[0] = a[1]*b[2]-b[1]*a[2];
12498 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12499 n[2] = a[0]*b[1]-b[0]*a[1];
12500 test_1 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12502 for (iDim = 0; iDim <
nDim; iDim++) {
12503 a[iDim] = 0.5*(Coord_3[iDim]-Coord_2[iDim]);
12504 b[iDim] = 0.5*(Coord_4[iDim]-Coord_2[iDim]);
12505 c[iDim] = Coord_5[iDim]-Coord_2[iDim];
12507 n[0] = a[1]*b[2]-b[1]*a[2];
12508 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12509 n[2] = a[0]*b[1]-b[0]*a[1];
12510 test_2 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12512 for (iDim = 0; iDim <
nDim; iDim++) {
12513 a[iDim] = 0.5*(Coord_4[iDim]-Coord_3[iDim]);
12514 b[iDim] = 0.5*(Coord_1[iDim]-Coord_3[iDim]);
12515 c[iDim] = Coord_5[iDim]-Coord_3[iDim];
12517 n[0] = a[1]*b[2]-b[1]*a[2];
12518 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12519 n[2] = a[0]*b[1]-b[0]*a[1];
12520 test_3 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12522 for (iDim = 0; iDim <
nDim; iDim++) {
12523 a[iDim] = 0.5*(Coord_1[iDim]-Coord_4[iDim]);
12524 b[iDim] = 0.5*(Coord_3[iDim]-Coord_4[iDim]);
12525 c[iDim] = Coord_5[iDim]-Coord_4[iDim];
12527 n[0] = a[1]*b[2]-b[1]*a[2];
12528 n[1] = -(a[0]*b[2]-b[0]*a[2]);
12529 n[2] = a[0]*b[1]-b[0]*a[1];
12530 test_4 = n[0]*c[0]+n[1]*c[1]+n[2]*c[2];
12532 if ((test_1 < 0.0) && (test_2 < 0.0) && (test_3 < 0.0) && (test_4 < 0.0)) {
12547 unsigned long Myline_flip = line_flip;
12548 unsigned long Mytriangle_flip = triangle_flip;
12549 unsigned long Myquad_flip = quad_flip;
12556 if (line_flip > 0) cout <<
"There has been a re-orientation of the LINE surface elements." << endl;
12557 if (triangle_flip > 0) cout <<
"There has been a re-orientation of the TRIANGLE surface elements." << endl;
12558 if (quad_flip > 0) cout <<
"There has been a re-orientation of the QUADRILATERAL surface elements." << endl;
12575 vector<unsigned long> meshToSurface(
nPoint, 0);
12579 vector<unsigned long> surfaceConn;
12580 vector<unsigned long> elemIDs;
12581 vector<unsigned short> VTK_TypeElem;
12582 vector<unsigned short> markerIDs;
12586 for(
unsigned short iMarker=0; iMarker<config->
GetnMarker_All(); ++iMarker) {
12596 for(
unsigned long iElem=0; iElem <
nElem_Bound[iMarker]; iElem++) {
12599 for (
unsigned short iNode = 0; iNode <
bound[iMarker][iElem]->
GetnNodes(); iNode++) {
12600 unsigned long iPoint =
bound[iMarker][iElem]->
GetNode(iNode);
12601 meshToSurface[iPoint] = 1;
12607 const unsigned short nDOFsPerElem =
bound[iMarker][iElem]->
GetnNodes();
12611 markerIDs.push_back(iMarker);
12612 VTK_TypeElem.push_back(VTK_Type);
12613 elemIDs.push_back(iElem);
12615 for (
unsigned short iNode = 0; iNode < nDOFsPerElem; iNode++)
12616 surfaceConn.push_back(
bound[iMarker][iElem]->
GetNode(iNode));
12625 vector<su2double> surfaceCoor;
12626 unsigned long nVertex_SolidWall = 0;
12628 for(
unsigned long i=0; i<
nPoint; ++i) {
12629 if( meshToSurface[i] ) {
12630 meshToSurface[i] = nVertex_SolidWall++;
12632 for(
unsigned short k=0; k<
nDim; ++k)
12639 for(
unsigned long i=0; i<surfaceConn.size(); ++i)
12640 surfaceConn[i] = meshToSurface[surfaceConn[i]];
12651 markerIDs, elemIDs,
true);
12655 vector<unsigned short>().swap(markerIDs);
12656 vector<unsigned short>().swap(VTK_TypeElem);
12657 vector<unsigned long>().swap(elemIDs);
12658 vector<unsigned long>().swap(surfaceConn);
12659 vector<su2double>().swap(surfaceCoor);
12672 for (
unsigned long iPoint=0; iPoint<
GetnPoint(); ++iPoint)
12673 node[iPoint]->SetWall_Distance(0.0);
12680 for (
unsigned long iPoint=0; iPoint<
GetnPoint(); ++iPoint) {
12681 unsigned short markerID;
12682 unsigned long elemID;
12695 unsigned short iMarker, Boundary, Monitoring;
12696 unsigned long iVertex, iPoint;
12697 su2double *Normal, PositiveXArea, PositiveYArea, PositiveZArea, WettedArea, CoordX = 0.0, CoordY = 0.0, CoordZ = 0.0, MinCoordX = 1E10, MinCoordY = 1E10,
12698 MinCoordZ = 1E10, MaxCoordX = -1E10, MaxCoordY = -1E10, MaxCoordZ = -1E10, TotalMinCoordX = 1E10, TotalMinCoordY = 1E10,
12699 TotalMinCoordZ = 1E10, TotalMaxCoordX = -1E10, TotalMaxCoordY = -1E10, TotalMaxCoordZ = -1E10;
12700 su2double TotalPositiveXArea = 0.0, TotalPositiveYArea = 0.0, TotalPositiveZArea = 0.0, TotalWettedArea = 0.0, AxiFactor;
12705 PositiveXArea = 0.0;
12706 PositiveYArea = 0.0;
12707 PositiveZArea = 0.0;
12710 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
12722 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
12725 if (
node[iPoint]->GetDomain()) {
12732 else AxiFactor = 1.0;
12734 if (
nDim == 2) WettedArea += AxiFactor * sqrt (Normal[0]*Normal[0] + Normal[1]*Normal[1]);
12735 if (
nDim == 3) WettedArea += sqrt (Normal[0]*Normal[0] + Normal[1]*Normal[1] + Normal[2]*Normal[2]);
12737 if (Normal[0] < 0) PositiveXArea -= Normal[0];
12738 if (Normal[1] < 0) PositiveYArea -= Normal[1];
12739 if ((
nDim == 3) && (Normal[2] < 0)) PositiveZArea -= Normal[2];
12741 if (CoordX < MinCoordX) MinCoordX = CoordX;
12742 if (CoordX > MaxCoordX) MaxCoordX = CoordX;
12744 if (CoordY < MinCoordY) MinCoordY = CoordY;
12745 if (CoordY > MaxCoordY) MaxCoordY = CoordY;
12748 if (CoordZ < MinCoordZ) MinCoordZ = CoordZ;
12749 if (CoordZ > MaxCoordZ) MaxCoordZ = CoordZ;
12772 TotalPositiveXArea = PositiveXArea;
12773 TotalPositiveYArea = PositiveYArea;
12774 TotalPositiveZArea = PositiveZArea;
12776 TotalMinCoordX = MinCoordX;
12777 TotalMinCoordY = MinCoordY;
12778 TotalMinCoordZ = MinCoordZ;
12780 TotalMaxCoordX = MaxCoordX;
12781 TotalMaxCoordY = MaxCoordY;
12782 TotalMaxCoordZ = MaxCoordZ;
12784 TotalWettedArea = WettedArea;
12792 else config->
SetRefArea(TotalPositiveYArea);
12796 cout <<
"Reference area = "<< TotalPositiveZArea;
12800 cout <<
"Reference length = "<< TotalPositiveYArea;
12815 cout <<
"Semi-span length = "<< TotalMaxCoordY;
12823 if (fea) cout <<
"Surface area = "<< TotalWettedArea;
12824 else cout <<
"Wetted area = "<< TotalWettedArea;
12826 if ((
nDim == 3) || (axisymmetric)) {
if (config->
GetSystemMeasurements() ==
SI) cout <<
" m^2." << endl;
else cout <<
" ft^2." << endl; }
12829 cout <<
"Area projection in the x-plane = "<< TotalPositiveXArea;
12833 cout <<
" y-plane = "<< TotalPositiveYArea;
12837 if (
nDim == 3) { cout <<
" z-plane = "<< TotalPositiveZArea;
12840 cout <<
"Max. coordinate in the x-direction = "<< TotalMaxCoordX;
12843 cout <<
" y-direction = "<< TotalMaxCoordY;
12847 cout <<
", z-direction = "<< TotalMaxCoordZ;
12850 else cout <<
"." << endl;
12852 cout <<
"Min coordinate in the x-direction = "<< TotalMinCoordX;
12855 cout <<
" y-direction = "<< TotalMinCoordY;
12859 cout <<
", z-direction = "<< TotalMinCoordZ;
12862 else cout <<
"." << endl;
12870 unsigned short Node_Neighbor, iNode, iNeighbor;
12871 unsigned long jElem, Point_Neighbor, iPoint, iElem;
12875 for (iElem = 0; iElem <
nElem; iElem++)
12879 for (iNode = 0; iNode <
elem[iElem]->
GetnNodes(); iNode++) {
12889 for (iPoint = 0; iPoint <
nPoint; iPoint++)
12893 for (iElem = 0; iElem <
node[iPoint]->
GetnElem(); iElem++) {
12901 if (
elem[jElem]->GetNode(iNode) == iPoint)
12907 Point_Neighbor =
elem[jElem]->
GetNode(Node_Neighbor);
12918 for (iPoint = 0; iPoint <
nPoint; iPoint++)
12924 unsigned long iPoint, AdjPoint, AuxPoint, AddPoint, iElem, iNode, jNode;
12925 vector<unsigned long> Queue, AuxQueue, Result;
12926 unsigned short Degree, MinDegree, iDim, iMarker;
12929 inQueue =
new bool [
nPoint];
12931 for (iPoint = 0; iPoint <
nPoint; iPoint++)
12932 inQueue[iPoint] =
false;
12939 if (Degree < MinDegree) { MinDegree = Degree; AddPoint = iPoint; }
12944 Result.push_back(AddPoint); inQueue[AddPoint] =
true;
12955 for (iNode = 0; iNode <
node[AddPoint]->
GetnPoint(); iNode++) {
12957 if ((!inQueue[AdjPoint]) && (AdjPoint <
nPointDomain)) {
12958 AuxQueue.push_back(AdjPoint);
12962 if (AuxQueue.size() != 0) {
12966 for (iNode = 0; iNode < AuxQueue.size(); iNode++) {
12967 for (jNode = 0; jNode < AuxQueue.size() - 1 - iNode; jNode++) {
12969 AuxPoint = AuxQueue[jNode];
12970 AuxQueue[jNode] = AuxQueue[jNode+1];
12971 AuxQueue[jNode+1] = AuxPoint;
12976 Queue.insert(Queue.end(), AuxQueue.begin(), AuxQueue.end());
12977 for (iNode = 0; iNode < AuxQueue.size(); iNode++) {
12978 inQueue[AuxQueue[iNode]] =
true;
12986 if (Queue.size() != 0) {
12987 AddPoint = Queue[0];
12988 Result.push_back(Queue[0]);
12989 Queue.erase (Queue.begin(), Queue.begin()+1);
12996 }
while (Queue.size() != 0);
13001 if (inQueue[iPoint] ==
false) Result.push_back(iPoint);
13006 reverse(Result.begin(), Result.end());
13011 Result.push_back(iPoint);
13016 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
13028 unsigned long *AuxGlobalIndex;
13030 AuxGlobalIndex =
new unsigned long [
nPoint];
13032 for (iPoint = 0; iPoint <
nPoint; iPoint++)
13035 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
13037 for (iDim = 0; iDim <
nDim; iDim++) {
13038 AuxCoord[iPoint][iDim] =
node[iPoint]->
GetCoord(iDim);
13042 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
13044 for (iDim = 0; iDim <
nDim; iDim++)
13045 node[iPoint]->
SetCoord(iDim, AuxCoord[Result[iPoint]][iDim]);
13048 for (iPoint = 0; iPoint <
nPoint; iPoint++)
13049 delete[] AuxCoord[iPoint];
13051 delete[] AuxGlobalIndex;
13055 unsigned long *InvResult;
13056 InvResult =
new unsigned long [
nPoint];
13057 for (iPoint = 0; iPoint <
nPoint; iPoint++)
13058 InvResult[Result[iPoint]] = iPoint;
13060 for (iElem = 0; iElem <
nElem; iElem++) {
13061 for (iNode = 0; iNode <
elem[iElem]->
GetnNodes(); iNode++) {
13067 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
13068 for (iElem = 0; iElem <
nElem_Bound[iMarker]; iElem++) {
13071 if (Marker_Tag ==
"SEND_RECEIVE") {
13072 for (
unsigned long iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
13078 for (iNode = 0; iNode <
bound[iMarker][iElem]->
GetnNodes(); iNode++) {
13080 bound[iMarker][iElem]->
SetNode(iNode, InvResult[iPoint]);
13099 delete[] InvResult;
13104 unsigned short first_elem_face, second_elem_face, iFace, iNode, jElem;
13105 unsigned long face_point, Test_Elem, iElem;
13109 for (iElem = 0; iElem <
nElem; iElem++)
13112 face_point =
elem[iElem]->
GetNode(
elem[iElem]->GetFaces(iFace, iNode));
13116 for (jElem = 0; jElem <
node[face_point]->
GetnElem(); jElem++) {
13121 if ((
elem[iElem]->GetNeighbor_Elements(iFace) == -1) && (iElem < Test_Elem) &&
13122 (
FindFace(iElem, Test_Elem, first_elem_face, second_elem_face))) {
13138 unsigned short cont, iMarker, iElem, iNode_Domain, iNode_Surface;
13139 unsigned long Point_Domain, Point_Surface, Point, iElem_Surface, iElem_Domain;
13142 for (iMarker = 0; iMarker <
nMarker; iMarker++)
13143 for (iElem_Surface = 0; iElem_Surface <
nElem_Bound[iMarker]; iElem_Surface++) {
13149 for (iElem = 0; iElem <
node[Point]->
GetnElem(); iElem++) {
13151 cont = 0; iElem_Domain =
node[Point]->
GetElem(iElem);
13152 for (iNode_Domain = 0; iNode_Domain <
elem[iElem_Domain]->
GetnNodes(); iNode_Domain++) {
13153 Point_Domain =
elem[iElem_Domain]->
GetNode(iNode_Domain);
13154 for (iNode_Surface = 0; iNode_Surface <
bound[iMarker][iElem_Surface]->
GetnNodes(); iNode_Surface++) {
13155 Point_Surface =
bound[iMarker][iElem_Surface]->
GetNode(iNode_Surface);
13156 if (Point_Surface == Point_Domain) cont++;
13157 if (cont ==
bound[iMarker][iElem_Surface]->GetnNodes())
break;
13159 if (cont ==
bound[iMarker][iElem_Surface]->GetnNodes())
break;
13162 if (cont ==
bound[iMarker][iElem_Surface]->GetnNodes()) {
13170 SPRINTF(buf,
"The surface element (%u, %lu) doesn't have an associated volume element", iMarker, iElem_Surface );
13177 unsigned long iPoint, iVertex, iElem;
13178 unsigned short iMarker, iNode;
13182 for (iPoint = 0; iPoint <
nPoint; iPoint++)
13183 for (iMarker = 0; iMarker <
nMarker; iMarker++)
13189 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
13194 for (iElem = 0; iElem <
nElem_Bound[iMarker]; iElem++)
13195 for (iNode = 0; iNode <
bound[iMarker][iElem]->
GetnNodes(); iNode++) {
13209 for (iPoint = 0; iPoint <
nPoint; iPoint++)
13210 for (iMarker = 0; iMarker <
nMarker; iMarker++)
13217 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
13223 for (iElem = 0; iElem <
nElem_Bound[iMarker]; iElem++)
13224 for (iNode = 0; iNode <
bound[iMarker][iElem]->
GetnNodes(); iNode++) {
13244 unsigned short iMarker, jMarker, iMarkerTP, iSpan, jSpan, kSpan = 0;
13245 unsigned long iPoint, iVertex;
13247 int nSpan, nSpan_loc;
13248 su2double *coord, *valueSpan, min, max, radius, delta;
13254 unsigned short iSize;
13256 int My_nSpan, My_MaxnSpan, *My_nSpan_loc = NULL;
13257 su2double MyMin, MyMax, *MyTotValueSpan =NULL,*MyValueSpan =NULL;
13269 for (iSpan = 0; iSpan < 1; iSpan++){
13276 for (iMarker = 0; iMarker <
nMarker; iMarker++){
13280 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
13285 for (jMarker = 0; jMarker <
nMarker; jMarker++){
13289 if (jVertex != -1) {
13291 if (isPeriodic && (SendRecv < 0)){
13309 My_nSpan = nSpan; nSpan = 0;
13310 My_MaxnSpan = nSpan_max; nSpan_max = 0;
13321 for (iSpan = 0; iSpan < nSpan; iSpan ++ ){
13322 valueSpan[iSpan] = -1001.0;
13328 for (iMarker = 0; iMarker <
nMarker; iMarker++){
13332 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
13334 for (jMarker = 0; jMarker <
nMarker; jMarker++){
13338 if (jVertex != -1) {
13340 if (isPeriodic && (SendRecv < 0)){
13344 valueSpan[nSpan_loc] = coord[2];
13347 valueSpan[nSpan_loc] = coord[2];
13350 valueSpan[nSpan_loc] = sqrt(coord[0]*coord[0]+coord[1]*coord[1]);
13354 valueSpan[nSpan_loc] = sqrt(coord[0]*coord[0]+coord[1]*coord[1]);
13357 valueSpan[nSpan_loc] = coord[2];
13361 if (marker_flag ==
INFLOW){
13362 valueSpan[nSpan_loc] = sqrt(coord[0]*coord[0]+coord[1]*coord[1]);
13365 valueSpan[nSpan_loc] = coord[2];
13385 MyValueSpan =
new su2double[nSpan_max];
13386 My_nSpan_loc =
new int[
size];
13387 for(iSpan = 0; iSpan < nSpan_max; iSpan++){
13388 MyValueSpan[iSpan] = -1001.0;
13389 for (iSize = 0; iSize<
size; iSize++){
13390 MyTotValueSpan[iSize*nSpan_max + iSpan] = -1001.0;
13394 for(iSpan = 0; iSpan <nSpan_loc; iSpan++){
13395 MyValueSpan[iSpan] = valueSpan[iSpan];
13398 for(iSpan = 0; iSpan <nSpan; iSpan++){
13399 valueSpan[iSpan] = -1001.0;
13406 for (iSize = 0; iSize<
size; iSize++){
13407 for(iSpan = 0; iSpan < My_nSpan_loc[iSize]; iSpan++){
13408 valueSpan[jSpan] = MyTotValueSpan[iSize*nSpan_max + iSpan];
13413 delete [] MyTotValueSpan;
delete [] MyValueSpan;
delete [] My_nSpan_loc;
13428 for (iSpan = 0; iSpan < nSpan; iSpan++){
13429 if(valueSpan[iSpan]< min) min = valueSpan[iSpan];
13434 for (iSpan = 0; iSpan < nSpan; iSpan++){
13440 for (iSpan = 1; iSpan < nSpan; iSpan++){
13442 for (jSpan = 0; jSpan < nSpan; jSpan++){
13443 if((valueSpan[jSpan] -
SpanWiseValue[marker_flag -1][iSpan-1]) < min && (valueSpan[jSpan] -
SpanWiseValue[marker_flag -1][iSpan-1]) >
EPS){
13444 min = valueSpan[jSpan] -
SpanWiseValue[marker_flag -1][iSpan-1];
13451 delete [] valueSpan;
13464 for (iMarker = 0; iMarker <
nMarker; iMarker++){
13468 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
13470 for (jMarker = 0; jMarker <
nMarker; jMarker++){
13474 if (jVertex != -1) {
13476 if (isPeriodic && (SendRecv < 0)){
13480 if (coord[2] < min) min = coord[2];
13481 if (coord[2] > max) max = coord[2];
13484 radius = sqrt(coord[0]*coord[0]+coord[1]*coord[1]);
13485 if (radius < min) min = radius;
13486 if (radius > max) max = radius;
13490 radius = sqrt(coord[0]*coord[0]+coord[1]*coord[1]);
13491 if (radius < min) min = radius;
13492 if (radius > max) max = radius;
13495 if (coord[2] < min) min = coord[2];
13496 if (coord[2] > max) max = coord[2];
13501 if (marker_flag ==
INFLOW){
13502 radius = sqrt(coord[0]*coord[0]+coord[1]*coord[1]);
13503 if (radius < min) min = radius;
13504 if (radius > max) max = radius;
13507 if (coord[2] < min) min = coord[2];
13508 if (coord[2] > max) max = coord[2];
13524 MyMin= min; min = 0;
13525 MyMax= max; max = 0;
13544 SU2_MPI::Error(
string(
" At the moment only turbomachinery with the same amount of span-wise section can be simulated\n") + buf,
CURRENT_FUNCTION);
13557 unsigned long iPoint, **ordered, **disordered, **oldVertex3D, iInternalVertex;
13558 unsigned long nVert, nVertMax;
13559 unsigned short iMarker, iMarkerTP, iSpan, jSpan, iDim;
13560 su2double min, minInt, max, *coord, dist, Normal2, *TurboNormal, *NormalArea, target = 0.0, **area, ***unitnormal, Area = 0.0;
13561 bool **checkAssign;
13567 long iVertex, iSpanVertex, jSpanVertex, kSpanVertex = 0;
13568 int *nTotVertex_gb, *nVertexSpanHalo;
13569 su2double **x_loc, **y_loc, **z_loc, **angCoord_loc, **deltaAngCoord_loc, **angPitch, **deltaAngPitch, *minIntAngPitch,
13570 *minAngPitch, *maxAngPitch;
13573 unsigned short iSize, kSize = 0, jSize;
13575 su2double *x_gb = NULL, *y_gb = NULL, *z_gb = NULL, *angCoord_gb = NULL, *deltaAngCoord_gb = NULL;
13576 bool *checkAssign_gb =NULL;
13577 unsigned long My_nVert;
13580 string multizone_filename;
13597 nTotVertex_gb[iSpan] = -1;
13598 nVertexSpanHalo[iSpan] = 0;
13599 minAngPitch[iSpan] = 10.0E+06;
13600 minIntAngPitch[iSpan] = 10.0E+06;
13601 maxAngPitch[iSpan] = -10.0E+06;
13618 for (iMarker = 0; iMarker <
nMarker; iMarker++){
13647 for (iMarker = 0; iMarker <
nMarker; iMarker++){
13653 for (iVertex = 0; (
unsigned long)iVertex <
nVertex[iMarker]; iVertex++) {
13663 if (dist > (abs(coord[2]-
SpanWiseValue[marker_flag-1][iSpan]))){
13670 radius = sqrt(coord[0]*coord[0]+coord[1]*coord[1]);
13672 if (dist > (abs(radius -
SpanWiseValue[marker_flag-1][iSpan]))){
13680 radius = sqrt(coord[0]*coord[0]+coord[1]*coord[1]);
13682 if (dist > (abs(radius -
SpanWiseValue[marker_flag-1][iSpan]))){
13690 if (dist > (abs(coord[2]-
SpanWiseValue[marker_flag-1][iSpan]))){
13699 if (marker_flag ==
INFLOW){
13700 radius = sqrt(coord[0]*coord[0]+coord[1]*coord[1]);
13702 if (dist > (abs(radius -
SpanWiseValue[marker_flag-1][iSpan]))){
13710 if (dist > (abs(coord[2]-
SpanWiseValue[marker_flag-1][iSpan]))){
13725 if(
node[iPoint]->GetDomain()){
13728 nVertexSpanHalo[jSpan]++;
13735 for (iVertex = 0; iVertex <
nVertexSpan[iMarker][iSpan]; iVertex++){
13739 ordered[iSpan] =
new unsigned long [nVertexSpanHalo[iSpan]];
13740 disordered[iSpan] =
new unsigned long [nVertexSpanHalo[iSpan]];
13741 oldVertex3D[iSpan] =
new unsigned long [nVertexSpanHalo[iSpan]];
13742 checkAssign[iSpan] =
new bool [nVertexSpanHalo[iSpan]];
13743 area[iSpan] =
new su2double [nVertexSpanHalo[iSpan]];
13744 unitnormal[iSpan] =
new su2double* [nVertexSpanHalo[iSpan]];
13745 for (iVertex = 0; iVertex < nVertexSpanHalo[iSpan]; iVertex++){
13748 angPitch[iSpan] =
new su2double [nVertexSpanHalo[iSpan]];
13749 deltaAngPitch[iSpan] =
new su2double [nVertexSpanHalo[iSpan]];
13750 nVertexSpanHalo[iSpan] = 0;
13754 for (iVertex = 0; (
unsigned long)iVertex <
nVertex[iMarker]; iVertex++) {
13764 if (dist > (abs(coord[2]-
SpanWiseValue[marker_flag-1][iSpan]))){
13771 radius = sqrt(coord[0]*coord[0]+coord[1]*coord[1]);
13773 if (dist > (abs(radius -
SpanWiseValue[marker_flag-1][iSpan]))){
13781 radius = sqrt(coord[0]*coord[0]+coord[1]*coord[1]);
13783 if (dist > (abs(radius -
SpanWiseValue[marker_flag-1][iSpan]))){
13790 if (dist > (abs(coord[2]-
SpanWiseValue[marker_flag-1][iSpan]))){
13799 if(marker_flag ==
INFLOW){
13800 radius = sqrt(coord[0]*coord[0]+coord[1]*coord[1]);
13802 if (dist > (abs(radius -
SpanWiseValue[marker_flag-1][iSpan]))){
13809 if (dist > (abs(coord[2]-
SpanWiseValue[marker_flag-1][iSpan]))){
13824 for (iDim = 0; iDim <
nDim; iDim++) NormalArea[iDim] = -NormalArea[iDim];
13826 for (iDim = 0; iDim <
nDim; iDim++)
13827 Area += NormalArea[iDim]*NormalArea[iDim];
13829 for (iDim = 0; iDim <
nDim; iDim++) NormalArea[iDim] /= Area;
13831 disordered[jSpan][nVertexSpanHalo[jSpan]] = iPoint;
13832 oldVertex3D[jSpan][nVertexSpanHalo[jSpan]] = iVertex;
13833 area[jSpan][nVertexSpanHalo[jSpan]] = Area;
13834 for (iDim = 0; iDim <
nDim; iDim++){
13835 unitnormal[jSpan][nVertexSpanHalo[jSpan]][iDim] = NormalArea[iDim];
13837 checkAssign[jSpan][nVertexSpanHalo[jSpan]] =
false;
13838 nVertexSpanHalo[jSpan]++;
13849 for(iSpanVertex = 0; iSpanVertex < nVertexSpanHalo[iSpan]; iSpanVertex++){
13850 iPoint = disordered[iSpan][iSpanVertex];
13862 kSpanVertex =iSpanVertex;
13866 if (coord[1]<minInt){
13867 if(
node[iPoint]->GetDomain()){
13870 minIntAngPitch[iSpan] = coord[1];
13873 minIntAngPitch[iSpan] = atan(coord[1]/coord[0]);
13880 if(
node[iPoint]->GetDomain()){
13893 iInternalVertex = 0;
13896 for(iSpanVertex = 0; iSpanVertex<nVertexSpanHalo[iSpan]; iSpanVertex++){
13898 ordered[iSpan][iSpanVertex] = disordered[iSpan][kSpanVertex];
13899 checkAssign[iSpan][kSpanVertex] =
true;
13900 coord =
node[ordered[iSpan][iSpanVertex]]->
GetCoord();
13903 angPitch[iSpan][iSpanVertex]=coord[1];
13906 angPitch[iSpan][iSpanVertex]=atan(coord[1]/coord[0]);
13908 if(iSpanVertex == 0){
13909 deltaAngPitch[iSpan][iSpanVertex]=0.0;
13912 deltaAngPitch[iSpan][iSpanVertex]= angPitch[iSpan][iSpanVertex] - angPitch[iSpan][iSpanVertex - 1];
13915 if(
node[ordered[iSpan][iSpanVertex]]->GetDomain()){
13927 for(iDim = 0; iDim < 2; iDim++) Normal2 +=coord[iDim]*coord[iDim];
13928 if (marker_flag ==
INFLOW){
13929 TurboNormal[0] = -coord[0]/sqrt(Normal2);
13930 TurboNormal[1] = -coord[1]/sqrt(Normal2);
13931 TurboNormal[2] = 0.0;
13933 TurboNormal[0] = coord[0]/sqrt(Normal2);
13934 TurboNormal[1] = coord[1]/sqrt(Normal2);
13935 TurboNormal[2] = 0.0;
13940 for(iDim = 0; iDim < 2; iDim++) Normal2 +=coord[iDim]*coord[iDim];
13942 TurboNormal[0] = -coord[0]/sqrt(Normal2);
13943 TurboNormal[1] = -coord[1]/sqrt(Normal2);
13944 TurboNormal[2] = 0.0;
13946 TurboNormal[0] = coord[0]/sqrt(Normal2);
13947 TurboNormal[1] = coord[1]/sqrt(Normal2);
13948 TurboNormal[2] = 0.0;
13953 for(iDim = 0; iDim < 2; iDim++) Normal2 +=coord[iDim]*coord[iDim];
13955 if (marker_flag ==
INFLOW){
13956 TurboNormal[0] = coord[0]/sqrt(Normal2);
13957 TurboNormal[1] = coord[1]/sqrt(Normal2);
13958 TurboNormal[2] = 0.0;
13960 TurboNormal[0] = coord[0]/sqrt(Normal2);
13961 TurboNormal[1] = coord[1]/sqrt(Normal2);
13962 TurboNormal[2] = 0.0;
13966 if (marker_flag ==
INFLOW){
13967 TurboNormal[0] = -1.0;
13968 TurboNormal[1] = 0.0;
13969 TurboNormal[2] = 0.0;
13971 TurboNormal[0] = 1.0;
13972 TurboNormal[1] = 0.0;
13973 TurboNormal[2] = 0.0;
13980 for(iDim = 0; iDim < 2; iDim++) Normal2 +=coord[iDim]*coord[iDim];
13981 if (marker_flag ==
INFLOW){
13982 TurboNormal[0] = coord[0]/sqrt(Normal2);
13983 TurboNormal[1] = coord[1]/sqrt(Normal2);
13984 TurboNormal[2] = 0.0;
13986 TurboNormal[0] = coord[0]/sqrt(Normal2);
13987 TurboNormal[1] = coord[1]/sqrt(Normal2);
13988 TurboNormal[2] = 0.0;
13994 for(iDim = 0; iDim < 2; iDim++) Normal2 +=coord[iDim]*coord[iDim];
13995 if (marker_flag ==
INFLOW){
13996 TurboNormal[0] = coord[0]/sqrt(Normal2);
13997 TurboNormal[1] = coord[1]/sqrt(Normal2);
13998 TurboNormal[2] = 0.0;
14000 TurboNormal[0] = coord[0]/sqrt(Normal2);
14001 TurboNormal[1] = coord[1]/sqrt(Normal2);
14002 TurboNormal[2] = 0.0;
14012 for(jSpanVertex = 0; jSpanVertex<nVertexSpanHalo[iSpan]; jSpanVertex++){
14013 coord =
node[disordered[iSpan][jSpanVertex]]->
GetCoord();
14014 if(dist >= (coord[1] - target) && !checkAssign[iSpan][jSpanVertex] && (coord[1] - target) >= 0.0){
14015 dist= coord[1] - target;
14016 kSpanVertex =jSpanVertex;
14024 delete [] ordered[iSpan];
14025 delete [] disordered[iSpan];
14026 delete [] oldVertex3D[iSpan];
14027 delete [] checkAssign[iSpan];
14028 delete [] area[iSpan];
14029 delete [] angPitch[iSpan];
14030 delete [] deltaAngPitch[iSpan];
14032 for(iVertex=0; iVertex < nVertexSpanHalo[iSpan]; iVertex++){
14033 delete [] unitnormal[iSpan][iVertex];
14035 delete [] unitnormal[iSpan];
14050 MyMin = minAngPitch[iSpan]; minAngPitch[iSpan] = 10.0E+6;
14051 MyIntMin = minIntAngPitch[iSpan]; minIntAngPitch[iSpan] = 10.0E+6;
14052 MyMax = maxAngPitch[iSpan]; maxAngPitch[iSpan] = -10.0E+6;
14062 for (iMarker = 0; iMarker <
nMarker; iMarker++){
14070 for(iSpanVertex = 0; iSpanVertex<
nVertexSpan[iMarker][iSpan]; iSpanVertex++){
14080 My_nVert = nVert;nVert = 0;
14085 if(nVert > nVertMax){
14089 nTotVertex_gb[iSpan]= (int)nVert;
14091 for (iMarker = 0; iMarker <
nMarker; iMarker++){
14108 x_loc[iSpan] =
new su2double[nTotVertex_gb[iSpan]];
14109 y_loc[iSpan] =
new su2double[nTotVertex_gb[iSpan]];
14110 z_loc[iSpan] =
new su2double[nTotVertex_gb[iSpan]];
14111 angCoord_loc[iSpan] =
new su2double[nTotVertex_gb[iSpan]];
14112 deltaAngCoord_loc[iSpan] =
new su2double[nTotVertex_gb[iSpan]];
14113 rank_loc[iSpan] =
new int[nTotVertex_gb[iSpan]];
14114 for(iSpanVertex = 0; iSpanVertex<nTotVertex_gb[iSpan]; iSpanVertex++){
14115 x_loc[iSpan][iSpanVertex] = -1.0;
14116 y_loc[iSpan][iSpanVertex] = -1.0;
14117 z_loc[iSpan][iSpanVertex] = -1.0;
14118 angCoord_loc[iSpan][iSpanVertex] = -1.0;
14119 deltaAngCoord_loc[iSpan][iSpanVertex] = -1.0;
14120 rank_loc[iSpan][iSpanVertex] = -1;
14124 for (iMarker = 0; iMarker <
nMarker; iMarker++){
14129 for(iSpanVertex = 0; iSpanVertex<
nVertexSpan[iMarker][iSpan]; iSpanVertex++){
14132 x_loc[iSpan][iSpanVertex] = coord[0];
14133 y_loc[iSpan][iSpanVertex] = coord[1];
14135 z_loc[iSpan][iSpanVertex] = coord[2];
14138 z_loc[iSpan][iSpanVertex] = 0.0;
14157 deltaAngCoord_gb =
new su2double[nTotVertex_gb[iSpan]*
size];
14158 checkAssign_gb =
new bool[nTotVertex_gb[iSpan]*
size];
14160 for(iSize= 0; iSize <
size; iSize++){
14161 for(iSpanVertex = 0; iSpanVertex < nTotVertex_gb[iSpan]; iSpanVertex++){
14162 checkAssign_gb[iSize*nTotVertex_gb[iSpan] + iSpanVertex] =
false;
14173 for(iSpanVertex = 0; iSpanVertex<nTotVertex_gb[iSpan]; iSpanVertex++){
14174 x_loc[iSpan][iSpanVertex] = -1.0;
14175 y_loc[iSpan][iSpanVertex] = -1.0;
14176 z_loc[iSpan][iSpanVertex] = -1.0;
14177 angCoord_loc[iSpan][iSpanVertex] = -1.0;
14178 deltaAngCoord_loc[iSpan][iSpanVertex] = -1.0;
14184 for(iSize= 0; iSize <
size; iSize++){
14185 if (angCoord_gb[iSize*nTotVertex_gb[iSpan]] < min && angCoord_gb[iSize*nTotVertex_gb[iSpan]] >= 0.0){
14187 min = angCoord_gb[iSize*nTotVertex_gb[iSpan]];
14192 for(iSpanVertex = 0; iSpanVertex < nTotVertex_gb[iSpan]; iSpanVertex++){
14193 x_loc[iSpan][iSpanVertex] = x_gb[kSize*nTotVertex_gb[iSpan] + kSpanVertex];
14194 y_loc[iSpan][iSpanVertex] = y_gb[kSize*nTotVertex_gb[iSpan] + kSpanVertex];
14195 z_loc[iSpan][iSpanVertex] = z_gb[kSize*nTotVertex_gb[iSpan] + kSpanVertex];
14196 angCoord_loc[iSpan][iSpanVertex] = angCoord_gb[kSize*nTotVertex_gb[iSpan] + kSpanVertex];
14197 deltaAngCoord_loc[iSpan][iSpanVertex] = deltaAngCoord_gb[kSize*nTotVertex_gb[iSpan] + kSpanVertex];
14198 rank_loc[iSpan][iSpanVertex] = kSize;
14199 target = angCoord_loc[iSpan][iSpanVertex];
14200 checkAssign_gb[kSize*nTotVertex_gb[iSpan] + kSpanVertex] =
true;
14202 for(jSize= 0; jSize <
size; jSize++){
14203 for(jSpanVertex = 0; jSpanVertex < nTotVertex_gb[iSpan]; jSpanVertex++){
14204 if (angCoord_gb[jSize*nTotVertex_gb[iSpan] + jSpanVertex] < min && (angCoord_gb[jSize*nTotVertex_gb[iSpan] + jSpanVertex] - target) >= 0.0 && !checkAssign_gb[jSize*nTotVertex_gb[iSpan] + jSpanVertex]){
14206 kSpanVertex = jSpanVertex;
14207 min = angCoord_gb[jSize*nTotVertex_gb[iSpan] + jSpanVertex];
14214 delete [] x_gb;
delete [] y_gb;
delete [] z_gb;
delete [] angCoord_gb;
delete [] deltaAngCoord_gb;
delete[] checkAssign_gb;
14222 if (marker_flag ==
INFLOW && val_iZone ==0){
14223 std::string sPath =
"TURBOMACHINERY";
14224 mode_t nMode = 0733;
14226 #if defined(_WIN32)
14228 nError = mkdir(sPath.c_str());
14230 nError = _mkdir(sPath.c_str());
14233 nError = mkdir(sPath.c_str(),nMode);
14236 cout <<
"TURBOMACHINERY folder creation failed." <<endl;
14239 if (marker_flag ==
INFLOW){
14240 multizone_filename =
"TURBOMACHINERY/spanwise_division_inflow.dat";
14243 multizone_filename =
"TURBOMACHINERY/spanwise_division_outflow.dat";
14248 unsigned short lastindex = multizone_filename.find_last_of(
".");
14249 multizone_filename = multizone_filename.substr(0, lastindex);
14251 multizone_filename.append(
string(buffer));
14256 myfile.open (multizone_filename.data(), ios::out | ios::trunc);
14257 myfile.setf(ios::uppercase | ios::scientific);
14258 myfile.precision(8);
14260 myfile <<
"TITLE = \"Global index visualization file\"" << endl;
14261 myfile <<
"VARIABLES =" << endl;
14262 myfile.width(10); myfile <<
"\"iSpan\"";
14263 myfile.width(20); myfile <<
"\"x_coord\"" ;
14264 myfile.width(20); myfile <<
"\"y_coord\"" ;
14265 myfile.width(20); myfile <<
"\"z_coord\"" ;
14266 myfile.width(20); myfile <<
"\"radius\"" ;
14267 myfile.width(20); myfile <<
"\"Relative Angular Coord \"" ;
14268 myfile.width(20); myfile <<
"\"Delta Angular Coord \"" ;
14269 myfile.width(20); myfile <<
"\"processor\"" <<endl;
14271 for(iSpanVertex = 0; iSpanVertex < nTotVertex_gb[iSpan]; iSpanVertex++){
14272 radius = sqrt(x_loc[iSpan][iSpanVertex]*x_loc[iSpan][iSpanVertex] + y_loc[iSpan][iSpanVertex]*y_loc[iSpan][iSpanVertex]);
14273 myfile.width(10); myfile << iSpan;
14274 myfile.width(20); myfile << x_loc[iSpan][iSpanVertex];
14275 myfile.width(20); myfile << y_loc[iSpan][iSpanVertex];
14276 myfile.width(20); myfile << z_loc[iSpan][iSpanVertex];
14277 myfile.width(20); myfile << radius;
14279 myfile.width(20); myfile << angCoord_loc[iSpan][iSpanVertex];
14280 myfile.width(20); myfile << deltaAngCoord_loc[iSpan][iSpanVertex];
14283 myfile.width(20); myfile << angCoord_loc[iSpan][iSpanVertex]*180.0/
PI_NUMBER;
14284 myfile.width(20); myfile << deltaAngCoord_loc[iSpan][iSpanVertex]*180.0/
PI_NUMBER;
14286 myfile.width(20); myfile << rank_loc[iSpan][iSpanVertex]<<endl;
14294 delete [] x_loc[iSpan];
14295 delete [] y_loc[iSpan];
14296 delete [] z_loc[iSpan];
14297 delete [] angCoord_loc[iSpan];
14298 delete [] deltaAngCoord_loc[iSpan];
14299 delete [] rank_loc[iSpan];
14306 delete [] disordered;
14307 delete [] oldVertex3D;
14308 delete [] checkAssign;
14309 delete [] TurboNormal;
14310 delete [] unitnormal;
14311 delete [] NormalArea;
14315 delete [] angCoord_loc;
14316 delete [] nTotVertex_gb;
14317 delete [] nVertexSpanHalo;
14318 delete [] angPitch;
14319 delete [] deltaAngPitch;
14320 delete [] deltaAngCoord_loc;
14321 delete [] rank_loc;
14322 delete [] minAngPitch;
14323 delete [] maxAngPitch;
14324 delete [] minIntAngPitch;
14330 unsigned short iMarker, iMarkerTP, iSpan, iDim;
14331 long iSpanVertex, iPoint;
14332 su2double *coord, *TurboNormal, Normal2;
14337 for (iMarker = 0; iMarker <
nMarker; iMarker++){
14342 for(iSpanVertex = 0; iSpanVertex<
nVertexSpan[iMarker][iSpan]; iSpanVertex++){
14349 for(iDim = 0; iDim < 2; iDim++) Normal2 +=coord[iDim]*coord[iDim];
14350 if (marker_flag ==
INFLOW){
14351 TurboNormal[0] = -coord[0]/sqrt(Normal2);
14352 TurboNormal[1] = -coord[1]/sqrt(Normal2);
14353 TurboNormal[2] = 0.0;
14355 TurboNormal[0] = coord[0]/sqrt(Normal2);
14356 TurboNormal[1] = coord[1]/sqrt(Normal2);
14357 TurboNormal[2] = 0.0;
14362 for(iDim = 0; iDim < 2; iDim++) Normal2 +=coord[iDim]*coord[iDim];
14364 TurboNormal[0] = -coord[0]/sqrt(Normal2);
14365 TurboNormal[1] = -coord[1]/sqrt(Normal2);
14366 TurboNormal[2] = 0.0;
14368 TurboNormal[0] = coord[0]/sqrt(Normal2);
14369 TurboNormal[1] = coord[1]/sqrt(Normal2);
14370 TurboNormal[2] = 0.0;
14375 for(iDim = 0; iDim < 2; iDim++) Normal2 +=coord[iDim]*coord[iDim];
14377 if (marker_flag ==
INFLOW){
14378 TurboNormal[0] = coord[0]/sqrt(Normal2);
14379 TurboNormal[1] = coord[1]/sqrt(Normal2);
14380 TurboNormal[2] = 0.0;
14382 TurboNormal[0] = coord[0]/sqrt(Normal2);
14383 TurboNormal[1] = coord[1]/sqrt(Normal2);
14384 TurboNormal[2] = 0.0;
14388 if (marker_flag ==
INFLOW){
14389 TurboNormal[0] = -1.0;
14390 TurboNormal[1] = 0.0;
14391 TurboNormal[2] = 0.0;
14393 TurboNormal[0] = 1.0;
14394 TurboNormal[1] = 0.0;
14395 TurboNormal[2] = 0.0;
14402 for(iDim = 0; iDim < 2; iDim++) Normal2 +=coord[iDim]*coord[iDim];
14403 if (marker_flag ==
INFLOW){
14404 TurboNormal[0] = coord[0]/sqrt(Normal2);
14405 TurboNormal[1] = coord[1]/sqrt(Normal2);
14406 TurboNormal[2] = 0.0;
14408 TurboNormal[0] = coord[0]/sqrt(Normal2);
14409 TurboNormal[1] = coord[1]/sqrt(Normal2);
14410 TurboNormal[2] = 0.0;
14416 for(iDim = 0; iDim < 2; iDim++) Normal2 +=coord[iDim]*coord[iDim];
14417 if (marker_flag ==
INFLOW){
14418 TurboNormal[0] = coord[0]/sqrt(Normal2);
14419 TurboNormal[1] = coord[1]/sqrt(Normal2);
14420 TurboNormal[2] = 0.0;
14422 TurboNormal[0] = coord[0]/sqrt(Normal2);
14423 TurboNormal[1] = coord[1]/sqrt(Normal2);
14424 TurboNormal[2] = 0.0;
14438 delete [] TurboNormal;
14443 unsigned short iMarker, iMarkerTP, iSpan, iDim;
14444 unsigned long iPoint;
14445 su2double *TurboNormal,*coord, *Normal, turboNormal2, Normal2, *gridVel, TotalArea, TotalRadius, radius;
14446 su2double *TotalTurboNormal,*TotalNormal, *TotalGridVel, Area;
14457 su2double MyTotalArea, MyTotalRadius, *MyTotalTurboNormal= NULL, *MyTotalNormal= NULL, *MyTotalGridVel= NULL;
14461 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++){
14483 for(iDim=0; iDim <
nDim; iDim++){
14500 for (iDim=0; iDim<
nDim; iDim++) {
14501 TotalTurboNormal[iDim] =0.0;
14502 TotalNormal[iDim] =0.0;
14503 TotalGridVel[iDim] =0.0;
14507 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++){
14511 for(iVertex = 0; iVertex <
nVertexSpan[iMarker][iSpan]; iVertex++){
14518 radius = sqrt(coord[0]*coord[0] + coord[1]*coord[1]);
14525 TotalRadius += radius;
14526 for (iDim = 0; iDim <
nDim; iDim++) {
14527 TotalTurboNormal[iDim] +=TurboNormal[iDim];
14528 TotalNormal[iDim] +=Normal[iDim];
14530 if (grid_movement){
14532 for (iDim = 0; iDim <
nDim; iDim++) TotalGridVel[iDim] +=gridVel[iDim];
14542 MyTotalArea = TotalArea; TotalArea = 0;
14543 MyTotalRadius = TotalRadius; TotalRadius = 0;
14551 for (iDim = 0; iDim <
nDim; iDim++) {
14552 MyTotalTurboNormal[iDim] = TotalTurboNormal[iDim];
14553 TotalTurboNormal[iDim] = 0.0;
14554 MyTotalNormal[iDim] = TotalNormal[iDim];
14555 TotalNormal[iDim] = 0.0;
14556 MyTotalGridVel[iDim] = TotalGridVel[iDim];
14557 TotalGridVel[iDim] = 0.0;
14564 delete [] MyTotalTurboNormal;
delete [] MyTotalNormal;
delete [] MyTotalGridVel;
14568 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++){
14574 SpanArea[iMarker][iSpan] = TotalArea;
14577 turboNormal2 = 0.0;
14579 for (iDim = 0; iDim <
nDim; iDim++){
14580 turboNormal2 += TotalTurboNormal[iDim]*TotalTurboNormal[iDim];
14581 Normal2 += TotalNormal[iDim]*TotalNormal[iDim];
14583 for (iDim = 0; iDim <
nDim; iDim++){
14584 AverageTurboNormal[iMarker][iSpan][iDim] = TotalTurboNormal[iDim]/sqrt(turboNormal2);
14585 AverageNormal[iMarker][iSpan][iDim] = TotalNormal[iDim]/sqrt(Normal2);
14587 if (grid_movement){
14588 for (iDim = 0; iDim <
nDim; iDim++){
14593 if (marker_flag ==
INFLOW ){
14617 if (marker_flag ==
INFLOW)
14635 for(iDim=0; iDim <
nDim; iDim++){
14648 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++){
14652 turboNormal2 = 0.0;
14655 for (iDim = 0; iDim <
nDim; iDim++){
14659 for (iDim = 0; iDim <
nDim; iDim++){
14669 delete [] TotalTurboNormal;
14670 delete [] TotalNormal;
14671 delete [] TotalGridVel;
14672 delete [] TurboNormal;
14680 unsigned short iMarker, iMarkerTP;
14681 unsigned short iSpan, iDim;
14686 su2double tangGridVelIn, tangGridVelOut;
14687 su2double areaIn, areaOut, pitchIn, Pitch;
14688 su2double radiusIn, radiusOut, *turboNormal;
14717 unsigned short i, n1, n2, n1t,n2t;
14718 su2double *TurbGeoIn= NULL,*TurbGeoOut= NULL;
14719 su2double *TotTurbGeoIn = NULL,*TotTurbGeoOut = NULL;
14730 TurbGeoIn[i] = -1.0;
14732 TurbGeoOut[i] = -1.0;
14736 tangGridVelIn = -1.0;
14738 for(iDim = 0; iDim <
nDim; iDim++){
14739 turboNormal[iDim] = -1.0;
14743 tangGridVelOut = -1.0;
14748 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++){
14752 markerTP = iMarkerTP;
14756 areaIn =
SpanArea[iMarker][iSpan];
14763 TurbGeoIn[0] = areaIn;
14764 TurbGeoIn[1] = tangGridVelIn;
14765 TurbGeoIn[2] = radiusIn;
14766 TurbGeoIn[3] = turboNormal[0];
14767 TurbGeoIn[4] = turboNormal[1];
14768 TurbGeoIn[5] = pitchIn;
14777 areaOut =
SpanArea[iMarker][iSpan];
14781 TurbGeoOut[0] = areaOut;
14782 TurbGeoOut[1] = tangGridVelOut;
14783 TurbGeoOut[2] = radiusOut;
14793 for (i=0;i<n1t;i++)
14794 TotTurbGeoIn[i] = -1.0;
14795 for (i=0;i<n2t;i++)
14796 TotTurbGeoOut[i] = -1.0;
14797 TotMarkerTP =
new int[
size];
14798 for(i=0; i<
size; i++){
14799 TotMarkerTP[i] = -1;
14806 delete [] TurbGeoIn,
delete [] TurbGeoOut;
14809 for (i=0;i<
size;i++){
14810 if(TotTurbGeoIn[n1*i] > 0.0){
14812 areaIn = TotTurbGeoIn[n1*i];
14813 tangGridVelIn = 0.0;
14814 tangGridVelIn = TotTurbGeoIn[n1*i+1];
14816 radiusIn = TotTurbGeoIn[n1*i+2];
14817 turboNormal[0] = 0.0;
14818 turboNormal[0] = TotTurbGeoIn[n1*i+3];
14819 turboNormal[1] = 0.0;
14820 turboNormal[1] = TotTurbGeoIn[n1*i+4];
14822 pitchIn = TotTurbGeoIn[n1*i+5];
14825 markerTP = TotMarkerTP[i];
14828 if(TotTurbGeoOut[n2*i] > 0.0){
14830 areaOut = TotTurbGeoOut[n2*i];
14831 tangGridVelOut = 0.0;
14832 tangGridVelOut = TotTurbGeoOut[n2*i+1];
14834 radiusOut = TotTurbGeoOut[n2*i+2];
14838 delete [] TotTurbGeoIn,
delete [] TotTurbGeoOut;
delete [] TotMarkerTP;
14867 delete [] turboNormal;
14873 unsigned short nNode, iDim, iMarker, iNode;
14874 unsigned long elem_poin, edge_poin, iElem, iEdge;
14879 for (iElem = 0; iElem<
nElem; iElem++) {
14885 for (iNode = 0; iNode < nNode; iNode++) {
14888 for (iDim = 0; iDim <
nDim; iDim++)
14889 Coord[iNode][iDim]=
node[elem_poin]->GetCoord(iDim);
14896 for (iNode = 0; iNode < nNode; iNode++)
14897 if (Coord[iNode] != NULL)
delete[] Coord[iNode];
14898 if (Coord != NULL)
delete[] Coord;
14903 for (iMarker = 0; iMarker <
nMarker; iMarker++)
14904 for (iElem = 0; iElem <
nElem_Bound[iMarker]; iElem++) {
14910 for (iNode = 0; iNode < nNode; iNode++) {
14913 for (iDim = 0; iDim <
nDim; iDim++)
14914 Coord[iNode][iDim]=
node[elem_poin]->GetCoord(iDim);
14919 for (iNode = 0; iNode < nNode; iNode++)
14920 if (Coord[iNode] != NULL)
delete[] Coord[iNode];
14921 if (Coord != NULL)
delete[] Coord;
14926 for (iEdge = 0; iEdge <
nEdge; iEdge++) {
14932 for (iNode = 0; iNode < nNode; iNode++) {
14935 for (iDim = 0; iDim <
nDim; iDim++)
14936 Coord[iNode][iDim]=
node[edge_poin]->GetCoord(iDim);
14943 for (iNode = 0; iNode < nNode; iNode++)
14944 if (Coord[iNode] != NULL)
delete[] Coord[iNode];
14945 if (Coord != NULL)
delete[] Coord;
14950 unsigned short Neighbor_Node, iMarker, iNode, iNeighbor_Nodes, iDim;
14951 unsigned long Neighbor_Point, iVertex, iPoint, iElem;
14958 for (iMarker = 0; iMarker <
nMarker; iMarker++)
14959 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++)
14960 vertex[iMarker][iVertex]->SetZeroValues();
14968 for (iMarker = 0; iMarker <
nMarker; iMarker++)
14972 for (iElem = 0; iElem <
nElem_Bound[iMarker]; iElem++)
14976 for (iNode = 0; iNode <
bound[iMarker][iElem]->
GetnNodes(); iNode++) {
14982 for (iNeighbor_Nodes = 0; iNeighbor_Nodes <
bound[iMarker][iElem]->
GetnNeighbor_Nodes(iNode); iNeighbor_Nodes++) {
14984 Neighbor_Point =
bound[iMarker][iElem]->
GetNode(Neighbor_Node);
14988 iEdge =
FindEdge(iPoint, Neighbor_Point);
14989 for (iDim = 0; iDim <
nDim; iDim++) {
14990 Coord_Edge_CG[iDim] =
edge[iEdge]->
GetCG(iDim);
14991 Coord_Elem_CG[iDim] =
bound[iMarker][iElem]->
GetCG(iDim);
15006 if (iNeighbor_Nodes == 0)
vertex[iMarker][iVertex]->
SetNodes_Coord(Coord_Elem_CG, Coord_Edge_CG, Coord_Vertex);
15007 if (iNeighbor_Nodes == 1)
vertex[iMarker][iVertex]->
SetNodes_Coord(Coord_Edge_CG, Coord_Elem_CG, Coord_Vertex);
15013 delete[] Coord_Edge_CG;
15014 delete[] Coord_Elem_CG;
15015 delete[] Coord_Vertex;
15019 for (iMarker = 0; iMarker <
nMarker; iMarker ++)
15020 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
15022 Area = 0.0;
for (iDim = 0; iDim <
nDim; iDim++) Area += NormalFace[iDim]*NormalFace[iDim];
15024 if (Area == 0.0)
for (iDim = 0; iDim <
nDim; iDim++) NormalFace[iDim] =
EPS*
EPS;
15031 for (
unsigned long iPoint = 0; iPoint <
nPointDomain; iPoint++){
15043 unsigned short max_neighbor = 0;
15044 for (
unsigned short iNeigh = 0; iNeigh < nNeigh; iNeigh++) {
15048 const unsigned long jPoint =
node[iPoint]->
GetPoint(iNeigh);
15052 for (
unsigned short iDim = 0;iDim <
nDim; iDim++){
15058 if (delta_aux > passive_max_delta) {
15059 passive_max_delta = delta_aux;
15060 max_neighbor = iNeigh;
15067 const unsigned long jPoint =
node[iPoint]->
GetPoint(max_neighbor);
15071 for (
unsigned short iDim = 0;iDim <
nDim; iDim++) {
15072 max_delta += pow((Coord_j[iDim]-Coord_i[iDim]), 2.);
15074 max_delta = sqrt(max_delta);
15088 if (nMarker_InterfaceBound != 0) {
15090 unsigned short iMarker, iDim, jMarker, pMarker = 0;
15091 unsigned long iVertex, iPoint, pVertex = 0, pPoint = 0, jVertex, jPoint, iPointGlobal, jPointGlobal, jVertex_, pPointGlobal = 0;
15092 su2double *Coord_i, Coord_j[3], dist = 0.0, mindist, maxdist_local, maxdist_global;
15093 int iProcessor, pProcessor = 0;
15094 unsigned long nLocalVertex_Interface = 0, MaxLocalVertex_Interface = 0;
15095 int nProcessor =
size;
15097 unsigned long *Buffer_Send_nVertex =
new unsigned long [1];
15098 unsigned long *Buffer_Receive_nVertex =
new unsigned long [nProcessor];
15100 if (
rank ==
MASTER_NODE) cout <<
"Set Interface boundary conditions (if any)." << endl;
15105 nLocalVertex_Interface = 0;
15106 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
15108 for (iVertex = 0; iVertex <
GetnVertex(iMarker); iVertex++) {
15110 if (
node[iPoint]->GetDomain()) nLocalVertex_Interface ++;
15113 Buffer_Send_nVertex[0] = nLocalVertex_Interface;
15118 MaxLocalVertex_Interface = nLocalVertex_Interface;
15119 Buffer_Receive_nVertex[0] = Buffer_Send_nVertex[0];
15126 unsigned long *Buffer_Send_Point =
new unsigned long [MaxLocalVertex_Interface];
15127 unsigned long *Buffer_Send_GlobalIndex =
new unsigned long [MaxLocalVertex_Interface];
15128 unsigned long *Buffer_Send_Vertex =
new unsigned long [MaxLocalVertex_Interface];
15129 unsigned long *Buffer_Send_Marker =
new unsigned long [MaxLocalVertex_Interface];
15132 unsigned long *Buffer_Receive_Point =
new unsigned long [nProcessor*MaxLocalVertex_Interface];
15133 unsigned long *Buffer_Receive_GlobalIndex =
new unsigned long [nProcessor*MaxLocalVertex_Interface];
15134 unsigned long *Buffer_Receive_Vertex =
new unsigned long [nProcessor*MaxLocalVertex_Interface];
15135 unsigned long *Buffer_Receive_Marker =
new unsigned long [nProcessor*MaxLocalVertex_Interface];
15137 unsigned long nBuffer_Coord = MaxLocalVertex_Interface*
nDim;
15138 unsigned long nBuffer_Point = MaxLocalVertex_Interface;
15139 unsigned long nBuffer_GlobalIndex = MaxLocalVertex_Interface;
15140 unsigned long nBuffer_Vertex = MaxLocalVertex_Interface;
15141 unsigned long nBuffer_Marker = MaxLocalVertex_Interface;
15143 for (iVertex = 0; iVertex < MaxLocalVertex_Interface; iVertex++) {
15144 Buffer_Send_Point[iVertex] = 0;
15145 Buffer_Send_GlobalIndex[iVertex] = 0;
15146 Buffer_Send_Vertex[iVertex] = 0;
15147 Buffer_Send_Marker[iVertex] = 0;
15148 for (iDim = 0; iDim <
nDim; iDim++)
15149 Buffer_Send_Coord[iVertex*
nDim+iDim] = 0.0;
15154 nLocalVertex_Interface = 0;
15155 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
15157 for (iVertex = 0; iVertex <
GetnVertex(iMarker); iVertex++) {
15160 if (
node[iPoint]->GetDomain()) {
15161 Buffer_Send_Point[nLocalVertex_Interface] = iPoint;
15162 Buffer_Send_GlobalIndex[nLocalVertex_Interface] = iPointGlobal;
15163 Buffer_Send_Vertex[nLocalVertex_Interface] = iVertex;
15164 Buffer_Send_Marker[nLocalVertex_Interface] = iMarker;
15165 for (iDim = 0; iDim <
nDim; iDim++)
15166 Buffer_Send_Coord[nLocalVertex_Interface*
nDim+iDim] =
node[iPoint]->GetCoord(iDim);
15167 nLocalVertex_Interface++;
15172 for (
unsigned long iBuffer_Coord = 0; iBuffer_Coord < nBuffer_Coord; iBuffer_Coord++)
15173 Buffer_Receive_Coord[iBuffer_Coord] = Buffer_Send_Coord[iBuffer_Coord];
15174 for (
unsigned long iBuffer_Point = 0; iBuffer_Point < nBuffer_Point; iBuffer_Point++)
15175 Buffer_Receive_Point[iBuffer_Point] = Buffer_Send_Point[iBuffer_Point];
15176 for (
unsigned long iBuffer_GlobalIndex = 0; iBuffer_GlobalIndex < nBuffer_GlobalIndex; iBuffer_GlobalIndex++)
15177 Buffer_Receive_GlobalIndex[iBuffer_GlobalIndex] = Buffer_Send_GlobalIndex[iBuffer_GlobalIndex];
15178 for (
unsigned long iBuffer_Vertex = 0; iBuffer_Vertex < nBuffer_Vertex; iBuffer_Vertex++)
15179 Buffer_Receive_Vertex[iBuffer_Vertex] = Buffer_Send_Vertex[iBuffer_Vertex];
15180 for (
unsigned long iBuffer_Marker = 0; iBuffer_Marker < nBuffer_Marker; iBuffer_Marker++)
15181 Buffer_Receive_Marker[iBuffer_Marker] = Buffer_Send_Marker[iBuffer_Marker];
15193 maxdist_local = 0.0;
15194 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
15197 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
15201 if (
node[iPoint]->GetDomain()) {
15205 Coord_i =
node[iPoint]->
GetCoord(); mindist = 1E6; pProcessor = 0; pPoint = 0;
15208 for (iProcessor = 0; iProcessor < nProcessor; iProcessor++)
15209 for (jVertex = 0; jVertex < Buffer_Receive_nVertex[iProcessor]; jVertex++) {
15210 jPoint = Buffer_Receive_Point[iProcessor*MaxLocalVertex_Interface+jVertex];
15211 jPointGlobal = Buffer_Receive_GlobalIndex[iProcessor*MaxLocalVertex_Interface+jVertex];
15212 jVertex_ = Buffer_Receive_Vertex[iProcessor*MaxLocalVertex_Interface+jVertex];
15213 jMarker = Buffer_Receive_Marker[iProcessor*MaxLocalVertex_Interface+jVertex];
15215 if (jPointGlobal != iPointGlobal) {
15219 dist = 0.0;
for (iDim = 0; iDim <
nDim; iDim++) {
15220 Coord_j[iDim] = Buffer_Receive_Coord[(iProcessor*MaxLocalVertex_Interface+jVertex)*
nDim+iDim];
15221 dist += pow(Coord_j[iDim]-Coord_i[iDim],2.0);
15222 } dist = sqrt(dist);
15224 if (((dist < mindist) && (iProcessor !=
rank)) ||
15225 ((dist < mindist) && (iProcessor ==
rank) && (jPoint != iPoint))) {
15226 mindist = dist; pProcessor = iProcessor; pPoint = jPoint; pPointGlobal = jPointGlobal;
15227 pVertex = jVertex_; pMarker = jMarker;
15228 if (dist == 0.0)
break;
15235 maxdist_local = max(maxdist_local, mindist);
15236 vertex[iMarker][iVertex]->
SetDonorPoint(pPoint, pPointGlobal, pVertex, pMarker, pProcessor);
15238 if (mindist > epsilon) {
15239 cout.precision(10);
15241 cout <<
" Bad match for point " << iPoint <<
".\tNearest";
15242 cout <<
" donor distance: " << scientific << mindist <<
".";
15243 vertex[iMarker][iVertex]->
SetDonorPoint(iPoint, iPointGlobal, pVertex, pMarker, pProcessor);
15244 maxdist_local = min(maxdist_local, 0.0);
15253 maxdist_global = maxdist_local;
15258 if (
rank ==
MASTER_NODE) cout <<
"The max distance between points is: " << maxdist_global <<
"."<< endl;
15260 delete[] Buffer_Send_Coord;
15261 delete[] Buffer_Send_Point;
15263 delete[] Buffer_Receive_Coord;
15264 delete[] Buffer_Receive_Point;
15266 delete[] Buffer_Send_nVertex;
15267 delete[] Buffer_Receive_nVertex;
15269 delete [] Buffer_Send_GlobalIndex;
15270 delete [] Buffer_Send_Vertex;
15271 delete [] Buffer_Send_Marker;
15273 delete [] Buffer_Receive_GlobalIndex;
15274 delete [] Buffer_Receive_Vertex;
15275 delete [] Buffer_Receive_Marker;
15287 if (nMarker_NearFieldBound != 0) {
15289 unsigned short iMarker, iDim, jMarker, pMarker = 0;
15290 unsigned long iVertex, iPoint, pVertex = 0, pPoint = 0, jVertex, jPoint, iPointGlobal, jPointGlobal, jVertex_, pPointGlobal = 0;
15291 su2double *Coord_i, Coord_j[3], dist = 0.0, mindist, maxdist_local, maxdist_global;
15292 int iProcessor, pProcessor = 0;
15293 unsigned long nLocalVertex_NearField = 0, MaxLocalVertex_NearField = 0;
15294 int nProcessor =
size;
15296 unsigned long *Buffer_Send_nVertex =
new unsigned long [1];
15297 unsigned long *Buffer_Receive_nVertex =
new unsigned long [nProcessor];
15299 if (
rank ==
MASTER_NODE) cout <<
"Set NearField boundary conditions (if any)." << endl;
15304 nLocalVertex_NearField = 0;
15305 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
15307 for (iVertex = 0; iVertex <
GetnVertex(iMarker); iVertex++) {
15309 if (
node[iPoint]->GetDomain()) nLocalVertex_NearField ++;
15312 Buffer_Send_nVertex[0] = nLocalVertex_NearField;
15317 MaxLocalVertex_NearField = nLocalVertex_NearField;
15318 Buffer_Receive_nVertex[0] = Buffer_Send_nVertex[0];
15325 unsigned long *Buffer_Send_Point =
new unsigned long [MaxLocalVertex_NearField];
15326 unsigned long *Buffer_Send_GlobalIndex =
new unsigned long [MaxLocalVertex_NearField];
15327 unsigned long *Buffer_Send_Vertex =
new unsigned long [MaxLocalVertex_NearField];
15328 unsigned long *Buffer_Send_Marker =
new unsigned long [MaxLocalVertex_NearField];
15331 unsigned long *Buffer_Receive_Point =
new unsigned long [nProcessor*MaxLocalVertex_NearField];
15332 unsigned long *Buffer_Receive_GlobalIndex =
new unsigned long [nProcessor*MaxLocalVertex_NearField];
15333 unsigned long *Buffer_Receive_Vertex =
new unsigned long [nProcessor*MaxLocalVertex_NearField];
15334 unsigned long *Buffer_Receive_Marker =
new unsigned long [nProcessor*MaxLocalVertex_NearField];
15336 unsigned long nBuffer_Coord = MaxLocalVertex_NearField*
nDim;
15337 unsigned long nBuffer_Point = MaxLocalVertex_NearField;
15338 unsigned long nBuffer_GlobalIndex = MaxLocalVertex_NearField;
15339 unsigned long nBuffer_Vertex = MaxLocalVertex_NearField;
15340 unsigned long nBuffer_Marker = MaxLocalVertex_NearField;
15342 for (iVertex = 0; iVertex < MaxLocalVertex_NearField; iVertex++) {
15343 Buffer_Send_Point[iVertex] = 0;
15344 Buffer_Send_GlobalIndex[iVertex] = 0;
15345 Buffer_Send_Vertex[iVertex] = 0;
15346 Buffer_Send_Marker[iVertex] = 0;
15347 for (iDim = 0; iDim <
nDim; iDim++)
15348 Buffer_Send_Coord[iVertex*
nDim+iDim] = 0.0;
15353 nLocalVertex_NearField = 0;
15354 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
15356 for (iVertex = 0; iVertex <
GetnVertex(iMarker); iVertex++) {
15359 if (
node[iPoint]->GetDomain()) {
15360 Buffer_Send_Point[nLocalVertex_NearField] = iPoint;
15361 Buffer_Send_GlobalIndex[nLocalVertex_NearField] = iPointGlobal;
15362 Buffer_Send_Vertex[nLocalVertex_NearField] = iVertex;
15363 Buffer_Send_Marker[nLocalVertex_NearField] = iMarker;
15364 for (iDim = 0; iDim <
nDim; iDim++)
15365 Buffer_Send_Coord[nLocalVertex_NearField*
nDim+iDim] =
node[iPoint]->GetCoord(iDim);
15366 nLocalVertex_NearField++;
15371 for (
unsigned long iBuffer_Coord = 0; iBuffer_Coord < nBuffer_Coord; iBuffer_Coord++)
15372 Buffer_Receive_Coord[iBuffer_Coord] = Buffer_Send_Coord[iBuffer_Coord];
15373 for (
unsigned long iBuffer_Point = 0; iBuffer_Point < nBuffer_Point; iBuffer_Point++)
15374 Buffer_Receive_Point[iBuffer_Point] = Buffer_Send_Point[iBuffer_Point];
15375 for (
unsigned long iBuffer_GlobalIndex = 0; iBuffer_GlobalIndex < nBuffer_GlobalIndex; iBuffer_GlobalIndex++)
15376 Buffer_Receive_GlobalIndex[iBuffer_GlobalIndex] = Buffer_Send_GlobalIndex[iBuffer_GlobalIndex];
15377 for (
unsigned long iBuffer_Vertex = 0; iBuffer_Vertex < nBuffer_Vertex; iBuffer_Vertex++)
15378 Buffer_Receive_Vertex[iBuffer_Vertex] = Buffer_Send_Vertex[iBuffer_Vertex];
15379 for (
unsigned long iBuffer_Marker = 0; iBuffer_Marker < nBuffer_Marker; iBuffer_Marker++)
15380 Buffer_Receive_Marker[iBuffer_Marker] = Buffer_Send_Marker[iBuffer_Marker];
15392 maxdist_local = 0.0;
15393 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
15396 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
15400 if (
node[iPoint]->GetDomain()) {
15404 Coord_i =
node[iPoint]->
GetCoord(); mindist = 1E6; pProcessor = 0; pPoint = 0;
15407 for (iProcessor = 0; iProcessor < nProcessor; iProcessor++)
15408 for (jVertex = 0; jVertex < Buffer_Receive_nVertex[iProcessor]; jVertex++) {
15409 jPoint = Buffer_Receive_Point[iProcessor*MaxLocalVertex_NearField+jVertex];
15410 jPointGlobal = Buffer_Receive_GlobalIndex[iProcessor*MaxLocalVertex_NearField+jVertex];
15411 jVertex_ = Buffer_Receive_Vertex[iProcessor*MaxLocalVertex_NearField+jVertex];
15412 jMarker = Buffer_Receive_Marker[iProcessor*MaxLocalVertex_NearField+jVertex];
15414 if (jPointGlobal != iPointGlobal) {
15418 dist = 0.0;
for (iDim = 0; iDim <
nDim; iDim++) {
15419 Coord_j[iDim] = Buffer_Receive_Coord[(iProcessor*MaxLocalVertex_NearField+jVertex)*
nDim+iDim];
15420 dist += pow(Coord_j[iDim]-Coord_i[iDim],2.0);
15421 } dist = sqrt(dist);
15423 if (((dist < mindist) && (iProcessor !=
rank)) ||
15424 ((dist < mindist) && (iProcessor ==
rank) && (jPoint != iPoint))) {
15425 mindist = dist; pProcessor = iProcessor; pPoint = jPoint; pPointGlobal = jPointGlobal;
15426 pVertex = jVertex_; pMarker = jMarker;
15427 if (dist == 0.0)
break;
15434 maxdist_local = max(maxdist_local, mindist);
15435 vertex[iMarker][iVertex]->
SetDonorPoint(pPoint, pPointGlobal, pVertex, pMarker, pProcessor);
15437 if (mindist > epsilon) {
15438 cout.precision(10);
15440 cout <<
" Bad match for point " << iPoint <<
".\tNearest";
15441 cout <<
" donor distance: " << scientific << mindist <<
".";
15442 vertex[iMarker][iVertex]->
SetDonorPoint(iPoint, iPointGlobal, pVertex, pMarker, pProcessor);
15443 maxdist_local = min(maxdist_local, 0.0);
15452 maxdist_global = maxdist_local;
15457 if (
rank ==
MASTER_NODE) cout <<
"The max distance between points is: " << maxdist_global <<
"."<< endl;
15459 delete[] Buffer_Send_Coord;
15460 delete[] Buffer_Send_Point;
15462 delete[] Buffer_Receive_Coord;
15463 delete[] Buffer_Receive_Point;
15465 delete[] Buffer_Send_nVertex;
15466 delete[] Buffer_Receive_nVertex;
15468 delete [] Buffer_Send_GlobalIndex;
15469 delete [] Buffer_Send_Vertex;
15470 delete [] Buffer_Send_Marker;
15472 delete [] Buffer_Receive_GlobalIndex;
15473 delete [] Buffer_Receive_Vertex;
15474 delete [] Buffer_Receive_Marker;
15486 if (nMarker_ActDiskInlet != 0) {
15488 unsigned short iMarker, iDim;
15489 unsigned long iVertex, iPoint, iPointGlobal, pPoint = 0, pPointGlobal = 0, pVertex = 0, pMarker = 0, jVertex, jVertex_, jPoint, jPointGlobal, jMarker;
15490 su2double *Coord_i, Coord_j[3], dist = 0.0, mindist, maxdist_local = 0.0, maxdist_global = 0.0;
15491 int iProcessor, pProcessor = 0;
15492 unsigned long nLocalVertex_ActDisk = 0, MaxLocalVertex_ActDisk = 0;
15493 int nProcessor =
size;
15494 unsigned short Beneficiary = 0, Donor = 0, iBC;
15497 for (iBC = 0; iBC < 2; iBC++) {
15502 unsigned long *Buffer_Send_nVertex =
new unsigned long [1];
15503 unsigned long *Buffer_Receive_nVertex =
new unsigned long [nProcessor];
15505 if ((iBC == 0) && (
rank ==
MASTER_NODE)) cout <<
"Set Actuator Disk inlet boundary conditions." << endl;
15506 if ((iBC == 1) && (
rank ==
MASTER_NODE)) cout <<
"Set Actuator Disk outlet boundary conditions." << endl;
15511 nLocalVertex_ActDisk = 0;
15512 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
15514 for (iVertex = 0; iVertex <
GetnVertex(iMarker); iVertex++) {
15516 if (
node[iPoint]->GetDomain()) nLocalVertex_ActDisk ++;
15521 Buffer_Send_nVertex[0] = nLocalVertex_ActDisk;
15526 MaxLocalVertex_ActDisk = nLocalVertex_ActDisk;
15527 Buffer_Receive_nVertex[0] = Buffer_Send_nVertex[0];
15536 unsigned long *Buffer_Send_Point =
new unsigned long [MaxLocalVertex_ActDisk];
15537 unsigned long *Buffer_Send_GlobalIndex =
new unsigned long [MaxLocalVertex_ActDisk];
15538 unsigned long *Buffer_Send_Vertex =
new unsigned long [MaxLocalVertex_ActDisk];
15539 unsigned long *Buffer_Send_Marker =
new unsigned long [MaxLocalVertex_ActDisk];
15542 unsigned long *Buffer_Receive_Point =
new unsigned long [nProcessor*MaxLocalVertex_ActDisk];
15543 unsigned long *Buffer_Receive_GlobalIndex =
new unsigned long [nProcessor*MaxLocalVertex_ActDisk];
15544 unsigned long *Buffer_Receive_Vertex =
new unsigned long [nProcessor*MaxLocalVertex_ActDisk];
15545 unsigned long *Buffer_Receive_Marker =
new unsigned long [nProcessor*MaxLocalVertex_ActDisk];
15547 unsigned long nBuffer_Coord = MaxLocalVertex_ActDisk*
nDim;
15548 unsigned long nBuffer_Point = MaxLocalVertex_ActDisk;
15549 unsigned long nBuffer_GlobalIndex = MaxLocalVertex_ActDisk;
15550 unsigned long nBuffer_Vertex = MaxLocalVertex_ActDisk;
15551 unsigned long nBuffer_Marker = MaxLocalVertex_ActDisk;
15553 for (iVertex = 0; iVertex < MaxLocalVertex_ActDisk; iVertex++) {
15554 Buffer_Send_Point[iVertex] = 0;
15555 Buffer_Send_GlobalIndex[iVertex] = 0;
15556 Buffer_Send_Vertex[iVertex] = 0;
15557 Buffer_Send_Marker[iVertex] = 0;
15558 for (iDim = 0; iDim <
nDim; iDim++)
15559 Buffer_Send_Coord[iVertex*
nDim+iDim] = 0.0;
15564 nLocalVertex_ActDisk = 0;
15565 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
15567 for (iVertex = 0; iVertex <
GetnVertex(iMarker); iVertex++) {
15570 if (
node[iPoint]->GetDomain()) {
15571 Buffer_Send_Point[nLocalVertex_ActDisk] = iPoint;
15572 Buffer_Send_GlobalIndex[nLocalVertex_ActDisk] = iPointGlobal;
15573 Buffer_Send_Vertex[nLocalVertex_ActDisk] = iVertex;
15574 Buffer_Send_Marker[nLocalVertex_ActDisk] = iMarker;
15575 for (iDim = 0; iDim <
nDim; iDim++)
15576 Buffer_Send_Coord[nLocalVertex_ActDisk*
nDim+iDim] =
node[iPoint]->GetCoord(iDim);
15577 nLocalVertex_ActDisk++;
15584 for (
unsigned long iBuffer_Coord = 0; iBuffer_Coord < nBuffer_Coord; iBuffer_Coord++)
15585 Buffer_Receive_Coord[iBuffer_Coord] = Buffer_Send_Coord[iBuffer_Coord];
15586 for (
unsigned long iBuffer_Point = 0; iBuffer_Point < nBuffer_Point; iBuffer_Point++)
15587 Buffer_Receive_Point[iBuffer_Point] = Buffer_Send_Point[iBuffer_Point];
15588 for (
unsigned long iBuffer_GlobalIndex = 0; iBuffer_GlobalIndex < nBuffer_GlobalIndex; iBuffer_GlobalIndex++)
15589 Buffer_Receive_GlobalIndex[iBuffer_GlobalIndex] = Buffer_Send_GlobalIndex[iBuffer_GlobalIndex];
15590 for (
unsigned long iBuffer_Vertex = 0; iBuffer_Vertex < nBuffer_Vertex; iBuffer_Vertex++)
15591 Buffer_Receive_Vertex[iBuffer_Vertex] = Buffer_Send_Vertex[iBuffer_Vertex];
15592 for (
unsigned long iBuffer_Marker = 0; iBuffer_Marker < nBuffer_Marker; iBuffer_Marker++)
15593 Buffer_Receive_Marker[iBuffer_Marker] = Buffer_Send_Marker[iBuffer_Marker];
15605 maxdist_local = 0.0;
15607 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
15610 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
15615 if (
node[iPoint]->GetDomain()) {
15619 Coord_i =
node[iPoint]->
GetCoord(); mindist = 1E6; pProcessor = 0; pPoint = 0;
15625 for (iProcessor = 0; iProcessor < nProcessor; iProcessor++) {
15626 for (jVertex = 0; jVertex < Buffer_Receive_nVertex[iProcessor]; jVertex++) {
15627 jPoint = Buffer_Receive_Point[iProcessor*MaxLocalVertex_ActDisk+jVertex];
15628 jPointGlobal = Buffer_Receive_GlobalIndex[iProcessor*MaxLocalVertex_ActDisk+jVertex];
15629 jVertex_ = Buffer_Receive_Vertex[iProcessor*MaxLocalVertex_ActDisk+jVertex];
15630 jMarker = Buffer_Receive_Marker[iProcessor*MaxLocalVertex_ActDisk+jVertex];
15638 for (iDim = 0; iDim <
nDim; iDim++) {
15639 Coord_j[iDim] = Buffer_Receive_Coord[(iProcessor*MaxLocalVertex_ActDisk+jVertex)*
nDim+iDim];
15640 dist += pow(Coord_j[iDim]-Coord_i[iDim], 2.0);
15644 if (dist < mindist) {
15645 mindist = dist; pProcessor = iProcessor; pPoint = jPoint; pPointGlobal = jPointGlobal;
15646 pVertex = jVertex_; pMarker = jMarker;
15647 if (dist == 0.0)
break;
15657 maxdist_local = max(maxdist_local, mindist);
15658 vertex[iMarker][iVertex]->
SetDonorPoint(pPoint, pPointGlobal, pVertex, pMarker, pProcessor);
15661 if (mindist > epsilon) {
15662 cout.precision(10);
15664 cout <<
" Bad match for point " << iPoint <<
".\tNearest";
15665 cout <<
" donor distance: " << scientific << mindist <<
".";
15666 vertex[iMarker][iVertex]->
SetDonorPoint(iPoint, iPointGlobal, pVertex, pMarker, pProcessor);
15667 maxdist_local = min(maxdist_local, 0.0);
15677 maxdist_global = maxdist_local;
15682 if (
rank ==
MASTER_NODE) cout <<
"The max distance between points is: " << maxdist_global <<
"."<< endl;
15684 delete[] Buffer_Send_Coord;
15685 delete[] Buffer_Send_Point;
15687 delete[] Buffer_Receive_Coord;
15688 delete[] Buffer_Receive_Point;
15690 delete[] Buffer_Send_nVertex;
15691 delete[] Buffer_Receive_nVertex;
15693 delete [] Buffer_Send_GlobalIndex;
15694 delete [] Buffer_Send_Vertex;
15695 delete [] Buffer_Send_Marker;
15697 delete [] Buffer_Receive_GlobalIndex;
15698 delete [] Buffer_Receive_Vertex;
15699 delete [] Buffer_Receive_Marker;
15707 unsigned short val_iZone,
unsigned short val_nZone) {
15711 unsigned short iMarker, jMarker;
15712 unsigned long iVertex, iPoint, jVertex, jPoint = 0, pPoint = 0, pGlobalPoint = 0;
15713 su2double *Coord_i, *Coord_j, dist = 0.0, mindist, maxdist;
15718 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
15719 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
15724 for (jMarker = 0; jMarker < config_donor->
GetnMarker_All(); jMarker++)
15725 for (jVertex = 0; jVertex < geometry_donor->
GetnVertex(jMarker); jVertex++) {
15726 jPoint = geometry_donor->
vertex[jMarker][jVertex]->
GetNode();
15728 if (
nDim == 2) dist = sqrt(pow(Coord_j[0]-Coord_i[0],2.0) + pow(Coord_j[1]-Coord_i[1],2.0));
15729 if (
nDim == 3) dist = sqrt(pow(Coord_j[0]-Coord_i[0],2.0) + pow(Coord_j[1]-Coord_i[1],2.0) + pow(Coord_j[2]-Coord_i[2],2.0));
15731 if (dist < mindist) { mindist = dist; pPoint = jPoint; pGlobalPoint = geometry_donor->
node[jPoint]->
GetGlobalIndex();}
15734 maxdist = max(maxdist, mindist);
15742 unsigned short iMarker, iDim;
15743 unsigned long iVertex, iPoint, pPoint = 0, jVertex, jPoint, jGlobalPoint = 0, pGlobalPoint = 0;
15744 su2double *Coord_i, Coord_j[3], dist = 0.0, mindist, maxdist;
15745 int iProcessor, pProcessor = 0;
15746 unsigned long nLocalVertex_Zone = 0, nGlobalVertex_Zone = 0, MaxLocalVertex_Zone = 0;
15747 int nProcessor =
size;
15749 unsigned long *Buffer_Send_nVertex =
new unsigned long [1];
15750 unsigned long *Buffer_Receive_nVertex =
new unsigned long [nProcessor];
15754 nLocalVertex_Zone = 0;
15755 for (iMarker = 0; iMarker < config_donor->
GetnMarker_All(); iMarker++)
15756 for (iVertex = 0; iVertex < geometry_donor->
GetnVertex(iMarker); iVertex++) {
15757 iPoint = geometry_donor->
vertex[iMarker][iVertex]->
GetNode();
15758 if (geometry_donor->
node[iPoint]->
GetDomain()) nLocalVertex_Zone ++;
15761 Buffer_Send_nVertex[0] = nLocalVertex_Zone;
15770 unsigned long *Buffer_Send_Point =
new unsigned long [MaxLocalVertex_Zone];
15771 unsigned long *Buffer_Send_GlobalPoint =
new unsigned long [MaxLocalVertex_Zone];
15774 unsigned long *Buffer_Receive_Point =
new unsigned long [nProcessor*MaxLocalVertex_Zone];
15775 unsigned long *Buffer_Receive_GlobalPoint =
new unsigned long [nProcessor*MaxLocalVertex_Zone];
15777 unsigned long nBuffer_Coord = MaxLocalVertex_Zone*
nDim;
15778 unsigned long nBuffer_Point = MaxLocalVertex_Zone;
15781 for (iVertex = 0; iVertex < MaxLocalVertex_Zone; iVertex++) {
15782 Buffer_Send_Point[iVertex] = 0;
15783 Buffer_Send_GlobalPoint[iVertex] = 0;
15784 for (iDim = 0; iDim <
nDim; iDim++)
15785 Buffer_Send_Coord[iVertex*
nDim+iDim] = 0.0;
15789 nLocalVertex_Zone = 0;
15790 for (iMarker = 0; iMarker < config_donor->
GetnMarker_All(); iMarker++)
15791 for (iVertex = 0; iVertex < geometry_donor->
GetnVertex(iMarker); iVertex++) {
15792 iPoint = geometry_donor->
vertex[iMarker][iVertex]->
GetNode();
15794 Buffer_Send_Point[nLocalVertex_Zone] = iPoint;
15795 Buffer_Send_GlobalPoint[nLocalVertex_Zone] = geometry_donor->
node[iPoint]->
GetGlobalIndex();
15796 for (iDim = 0; iDim <
nDim; iDim++)
15797 Buffer_Send_Coord[nLocalVertex_Zone*
nDim+iDim] = geometry_donor->
node[iPoint]->
GetCoord(iDim);
15798 nLocalVertex_Zone++;
15808 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
15809 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
15812 if (
node[iPoint]->GetDomain()) {
15815 Coord_i =
node[iPoint]->
GetCoord(); mindist = 1E6; pProcessor = 0; pPoint = 0;
15818 for (iProcessor = 0; iProcessor < nProcessor; iProcessor++)
15819 for (jVertex = 0; jVertex < Buffer_Receive_nVertex[iProcessor]; jVertex++) {
15820 jPoint = Buffer_Receive_Point[iProcessor*MaxLocalVertex_Zone+jVertex];
15821 jGlobalPoint = Buffer_Receive_GlobalPoint[iProcessor*MaxLocalVertex_Zone+jVertex];
15824 dist = 0.0;
for (iDim = 0; iDim <
nDim; iDim++) {
15825 Coord_j[iDim] = Buffer_Receive_Coord[(iProcessor*MaxLocalVertex_Zone+jVertex)*
nDim+iDim];
15826 dist += pow(Coord_j[iDim]-Coord_i[iDim],2.0);
15827 } dist = sqrt(dist);
15829 if (((dist < mindist) && (iProcessor !=
rank)) ||
15830 ((dist < mindist) && (iProcessor ==
rank) && (jPoint != iPoint))) {
15831 mindist = dist; pProcessor = iProcessor; pPoint = jPoint;
15832 pGlobalPoint = jGlobalPoint;
15837 maxdist = max(maxdist, mindist);
15845 delete[] Buffer_Send_Coord;
15846 delete[] Buffer_Send_Point;
15847 delete[] Buffer_Send_GlobalPoint;
15849 delete[] Buffer_Receive_Coord;
15850 delete[] Buffer_Receive_Point;
15851 delete[] Buffer_Receive_GlobalPoint;
15853 delete[] Buffer_Send_nVertex;
15854 delete[] Buffer_Receive_nVertex;
15862 unsigned long face_iPoint = 0, face_jPoint = 0, iPoint, iElem;
15864 unsigned short nEdgesFace = 1, iFace, iEdgesFace, iDim;
15865 su2double *Coord_Edge_CG, *Coord_FaceElem_CG, *Coord_Elem_CG, *Coord_FaceiPoint, *Coord_FacejPoint, Area,
15866 Volume, DomainVolume, my_DomainVolume, *NormalFace = NULL;
15867 bool change_face_orientation;
15871 for (iEdge = 0; iEdge < (long)
nEdge; iEdge++)
15872 edge[iEdge]->SetZeroValues();
15873 for (iPoint = 0; iPoint <
nPoint; iPoint++)
15874 node[iPoint]->SetVolume (0.0);
15883 my_DomainVolume = 0.0;
15884 for (iElem = 0; iElem <
nElem; iElem++)
15885 for (iFace = 0; iFace <
elem[iElem]->
GetnFaces(); iFace++) {
15888 if (
nDim == 2) nEdgesFace = 1;
15893 for (iEdgesFace = 0; iEdgesFace < nEdgesFace; iEdgesFace++) {
15903 face_iPoint =
elem[iElem]->
GetNode(
elem[iElem]->GetFaces(iFace, iEdgesFace));
15904 if (iEdgesFace != nEdgesFace-1)
15905 face_jPoint =
elem[iElem]->
GetNode(
elem[iElem]->GetFaces(iFace, iEdgesFace+1));
15911 change_face_orientation =
false;
15912 if (face_iPoint > face_jPoint) change_face_orientation =
true;
15913 iEdge =
FindEdge(face_iPoint, face_jPoint);
15915 for (iDim = 0; iDim <
nDim; iDim++) {
15916 Coord_Edge_CG[iDim] =
edge[iEdge]->
GetCG(iDim);
15917 Coord_Elem_CG[iDim] =
elem[iElem]->
GetCG(iDim);
15918 Coord_FaceElem_CG[iDim] =
elem[iElem]->
GetFaceCG(iFace, iDim);
15919 Coord_FaceiPoint[iDim] =
node[face_iPoint]->
GetCoord(iDim);
15920 Coord_FacejPoint[iDim] =
node[face_jPoint]->
GetCoord(iDim);
15926 if (change_face_orientation)
edge[iEdge]->
SetNodes_Coord(Coord_Elem_CG, Coord_Edge_CG);
15928 Area =
edge[iEdge]->
GetVolume(Coord_FaceiPoint, Coord_Edge_CG, Coord_Elem_CG);
15929 node[face_iPoint]->
AddVolume(Area); my_DomainVolume +=Area;
15930 Area =
edge[iEdge]->
GetVolume(Coord_FacejPoint, Coord_Edge_CG, Coord_Elem_CG);
15931 node[face_jPoint]->
AddVolume(Area); my_DomainVolume +=Area;
15935 if (change_face_orientation)
edge[iEdge]->
SetNodes_Coord(Coord_FaceElem_CG, Coord_Edge_CG, Coord_Elem_CG);
15937 Volume =
edge[iEdge]->
GetVolume(Coord_FaceiPoint, Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
15938 node[face_iPoint]->
AddVolume(Volume); my_DomainVolume +=Volume;
15939 Volume =
edge[iEdge]->
GetVolume(Coord_FacejPoint, Coord_Edge_CG, Coord_FaceElem_CG, Coord_Elem_CG);
15940 node[face_jPoint]->
AddVolume(Volume); my_DomainVolume +=Volume;
15947 for (iEdge = 0; iEdge < (long)
nEdge; iEdge++) {
15949 Area = 0.0;
for (iDim = 0; iDim <
nDim; iDim++) Area += NormalFace[iDim]*NormalFace[iDim];
15951 if (Area == 0.0)
for (iDim = 0; iDim <
nDim; iDim++) NormalFace[iDim] =
EPS*
EPS;
15958 DomainVolume = my_DomainVolume;
15962 if (
nDim == 2) cout <<
"Area of the computational grid: "<< DomainVolume <<
"."<< endl;
15963 if (
nDim == 3) cout <<
"Volume of the computational grid: "<< DomainVolume <<
"."<< endl;
15968 delete[] Coord_Edge_CG;
15969 delete[] Coord_FaceElem_CG;
15970 delete[] Coord_Elem_CG;
15971 delete[] Coord_FaceiPoint;
15972 delete[] Coord_FacejPoint;
15980 unsigned long face_iPoint = 0, face_jPoint = 0, iElem, iPoint_Viz;
15982 unsigned short nEdgesFace = 1, iFace, iEdgesFace, iDim;
15983 su2double *Coord_Edge_CG, *Coord_FaceElem_CG, *Coord_Elem_CG, *Coord_FaceiPoint,
15987 ofstream Tecplot_File;
15988 string mesh_filename;
15989 vector<su2double> X, Y, Z, X_n, Y_n, Z_n;
15990 su2double r1[3], r2[3], CrossProduct[3];
16006 CrossProduct[0] = 0.0; CrossProduct[1] = 0.0; CrossProduct[2] = 0.0;
16008 for (iElem = 0; iElem <
nElem; iElem++) {
16010 for (iFace = 0; iFace <
elem[iElem]->
GetnFaces(); iFace++) {
16013 if (
nDim == 2) nEdgesFace = 1;
16018 for (iEdgesFace = 0; iEdgesFace < nEdgesFace; iEdgesFace++) {
16028 face_iPoint =
elem[iElem]->
GetNode(
elem[iElem]->GetFaces(iFace, iEdgesFace));
16029 if (iEdgesFace != nEdgesFace-1)
16030 face_jPoint =
elem[iElem]->
GetNode(
elem[iElem]->GetFaces(iFace, iEdgesFace+1));
16036 iEdge =
FindEdge(face_iPoint, face_jPoint);
16038 for (iDim = 0; iDim <
nDim; iDim++) {
16039 Coord_Edge_CG[iDim] =
edge[iEdge]->
GetCG(iDim);
16040 Coord_Elem_CG[iDim] =
elem[iElem]->
GetCG(iDim);
16041 Coord_FaceElem_CG[iDim] =
elem[iElem]->
GetFaceCG(iFace, iDim);
16042 Coord_FaceiPoint[iDim] =
node[face_iPoint]->
GetCoord(iDim);
16043 Coord_FacejPoint[iDim] =
node[face_jPoint]->
GetCoord(iDim);
16049 if (face_iPoint == iPoint_Viz || face_jPoint == iPoint_Viz) {
16052 X.push_back(Coord_Elem_CG[0]); X.push_back(Coord_Edge_CG[0]);
16053 Y.push_back(Coord_Elem_CG[1]); Y.push_back(Coord_Edge_CG[1]);
16054 }
else if (
nDim == 3) {
16055 X.push_back(Coord_FaceElem_CG[0]); X.push_back(Coord_Edge_CG[0]); X.push_back(Coord_Elem_CG[0]);
16056 Y.push_back(Coord_FaceElem_CG[1]); Y.push_back(Coord_Edge_CG[1]); Y.push_back(Coord_Elem_CG[1]);
16057 Z.push_back(Coord_FaceElem_CG[2]); Z.push_back(Coord_Edge_CG[2]); Z.push_back(Coord_Elem_CG[2]);
16059 for (iDim = 0; iDim <
nDim; iDim++) {
16060 r1[iDim] = Coord_FaceElem_CG[iDim]-Coord_Elem_CG[iDim];
16061 r2[iDim] = Coord_Edge_CG[iDim]-Coord_Elem_CG[iDim];
16063 CrossProduct[0] += 0.5*(r1[1]*r2[2] - r1[2]*r2[1]);
16064 CrossProduct[1] += 0.5*(r1[2]*r2[0] - r1[0]*r2[2]);
16065 CrossProduct[2] += 0.5*(r1[0]*r2[1] - r1[1]*r2[0]);
16075 strcpy(cstr,
"dual_cv");
16077 strcat(cstr, buffer);
16079 Tecplot_File.open(cstr, ios::out);
16080 Tecplot_File <<
"TITLE= \"Visualization of the control volume\"" << endl;
16083 Tecplot_File <<
"VARIABLES = \"x\",\"y\" " << endl;
16084 Tecplot_File <<
"ZONE NODES= "<< counter*2 <<
", ELEMENTS= ";
16085 Tecplot_File << counter <<
", DATAPACKING=POINT, ZONETYPE=FEQUADRILATERAL"<< endl;
16087 Tecplot_File <<
"VARIABLES = \"x\",\"y\",\"z\" " << endl;
16088 Tecplot_File <<
"ZONE NODES= "<< counter*3 <<
", ELEMENTS= ";
16089 Tecplot_File << counter <<
", DATAPACKING=POINT, ZONETYPE=FEBRICK"<< endl;
16095 for (vector<su2double>::size_type i = 0; i != X.size(); i++) {
16096 Tecplot_File << X[i] <<
"\t" << Y[i];
16097 if (
nDim == 3) Tecplot_File <<
"\t" << Z[i];
16098 Tecplot_File <<
"\n";
16104 for (
int i= 0; i < counter; i++) {
16107 Tecplot_File << j+1 <<
"\t"<<j+2 <<
"\t"<<j+2 <<
"\t"<<j+2 << endl;
16110 Tecplot_File << j+1 <<
"\t"<<j+2 <<
"\t"<<j+3 <<
"\t"<<j+3 <<
"\t";
16111 Tecplot_File << j+3<<
"\t" <<j+3 <<
"\t"<<j+3 <<
"\t"<<j+3 << endl;
16115 Tecplot_File.close();
16120 delete[] Coord_Edge_CG;
16121 delete[] Coord_FaceElem_CG;
16122 delete[] Coord_Elem_CG;
16123 delete[] Coord_FaceiPoint;
16124 delete[] Coord_FacejPoint;
16131 unsigned long iElem, iPoint, iElem_Bound;
16132 unsigned short iMarker, iNodes, iDim;
16133 unsigned short iPeriodic, nPeriodic = 0;
16134 ofstream output_file;
16135 string Grid_Marker;
16139 cstr =
new char [val_mesh_out_filename.size()+1];
16140 strcpy (cstr, val_mesh_out_filename.c_str());
16144 output_file.precision(15);
16145 output_file.open(cstr, ios::out);
16149 output_file <<
"NDIME= " <<
nDim << endl;
16150 output_file <<
"NELEM= " <<
nElem << endl;
16151 for (iElem = 0; iElem <
nElem; iElem++) {
16153 for (iNodes = 0; iNodes <
elem[iElem]->
GetnNodes(); iNodes++)
16154 output_file <<
"\t" <<
elem[iElem]->GetNode(iNodes);
16155 output_file <<
"\t"<<iElem<< endl;
16161 output_file.precision(15);
16162 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
16163 for (iDim = 0; iDim <
nDim; iDim++)
16164 output_file << scientific <<
"\t" <<
node[iPoint]->GetCoord(iDim) ;
16166 output_file <<
"\t" << iPoint << endl;
16175 output_file <<
"NMARK= " <<
nMarker << endl;
16176 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
16179 if (
bound[iMarker][0]->GetVTK_Type() !=
VERTEX) {
16182 output_file <<
"MARKER_TAG= " << Grid_Marker << endl;
16183 output_file <<
"MARKER_ELEMS= " <<
nElem_Bound[iMarker]<< endl;
16186 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
16188 for (iNodes = 0; iNodes <
bound[iMarker][iElem_Bound]->
GetnNodes(); iNodes++)
16189 output_file <<
bound[iMarker][iElem_Bound]->GetNode(iNodes) <<
"\t" ;
16190 output_file << iElem_Bound << endl;
16195 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
16197 for (iNodes = 0; iNodes <
bound[iMarker][iElem_Bound]->
GetnNodes(); iNodes++)
16198 output_file <<
bound[iMarker][iElem_Bound]->GetNode(iNodes) <<
"\t" ;
16199 output_file << iElem_Bound << endl;
16203 }
else if (
bound[iMarker][0]->GetVTK_Type() ==
VERTEX) {
16204 output_file <<
"MARKER_TAG= SEND_RECEIVE" << endl;
16205 output_file <<
"MARKER_ELEMS= " <<
nElem_Bound[iMarker]<< endl;
16209 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
16221 output_file <<
"NPERIODIC= " << nPeriodic << endl;
16225 for (iPeriodic = 0; iPeriodic < nPeriodic; iPeriodic++) {
16233 output_file <<
"PERIODIC_INDEX= " << iPeriodic << endl;
16234 output_file << center[0] <<
"\t" << center[1] <<
"\t" << center[2] << endl;
16235 output_file << angles[0] <<
"\t" << angles[1] <<
"\t" << angles[2] << endl;
16236 output_file << transl[0] <<
"\t" << transl[1] <<
"\t" << transl[2] << endl;
16241 output_file.close();
16245 unsigned short iSmooth, nneigh, iMarker;
16246 su2double *Coord_Old, *Coord_Sum, *Coord, *Coord_i, *Coord_j, Position_Plane = 0.0;
16247 unsigned long iEdge, iPoint, jPoint, iVertex;
16249 bool NearField =
false;
16253 for (iPoint = 0; iPoint <
GetnPoint(); iPoint++) {
16259 for (iSmooth = 0; iSmooth < val_nSmooth; iSmooth++) {
16261 for (iPoint = 0; iPoint <
nPoint; iPoint++)
16262 node[iPoint]->SetCoord_SumZero();
16266 for (iEdge = 0; iEdge <
nEdge; iEdge++) {
16280 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
16286 Coord[0] =(Coord_Old[0] + val_smooth_coeff*Coord_Sum[0]) /(1.0 + val_smooth_coeff*
su2double(nneigh));
16287 Coord[1] =(Coord_Old[1] + val_smooth_coeff*Coord_Sum[1]) /(1.0 + val_smooth_coeff*
su2double(nneigh));
16288 if ((NearField) && ((Coord_Old[1] > Position_Plane-
eps) && (Coord_Old[1] < Position_Plane+
eps)))
16289 Coord[1] = Coord_Old[1];
16293 Coord[0] =(Coord_Old[0] + val_smooth_coeff*Coord_Sum[0]) /(1.0 + val_smooth_coeff*
su2double(nneigh));
16294 Coord[1] =(Coord_Old[1] + val_smooth_coeff*Coord_Sum[1]) /(1.0 + val_smooth_coeff*
su2double(nneigh));
16295 Coord[2] =(Coord_Old[2] + val_smooth_coeff*Coord_Sum[2]) /(1.0 + val_smooth_coeff*
su2double(nneigh));
16296 if ((NearField) && ((Coord_Old[2] > Position_Plane-
eps) && (Coord_Old[2] < Position_Plane+
eps)))
16297 Coord[2] = Coord_Old[2];
16304 for (iMarker = 0; iMarker <
nMarker; iMarker++)
16305 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
16316 unsigned short &face_second_elem) {
16319 unsigned long iPoint = 0, jPoint = 0;
16320 unsigned short face_node, iFace, iNode, jNode, nNodesFace;
16321 vector<unsigned long> CommonPoints, PointFaceFirst, PointFaceSecond;
16322 vector<unsigned long>::iterator IterPoint;
16323 pair<vector <unsigned long>::iterator, vector <unsigned long>::iterator> mypair;
16324 bool face_first_found =
false, face_second_found =
false;
16326 if (first_elem == second_elem)
return false;
16328 for (iNode = 0; iNode <
elem[first_elem]->
GetnNodes(); iNode++) {
16330 for (jNode = 0; jNode <
elem[second_elem]->
GetnNodes(); jNode++) {
16332 if (iPoint == jPoint) {
16333 CommonPoints.push_back(iPoint);
16340 sort( CommonPoints.begin(), CommonPoints.end());
16341 IterPoint = unique( CommonPoints.begin(), CommonPoints.end());
16342 CommonPoints.resize( distance(CommonPoints.begin(), IterPoint) );
16349 if ((
nDim == 2) && (CommonPoints.size() != 2))
return false;
16350 if ((
nDim == 3) && ((CommonPoints.size() != 3) &&
16351 (CommonPoints.size() != 4)))
return false;
16354 for (iFace = 0; iFace <
elem[first_elem]->
GetnFaces(); iFace++) {
16357 if (nNodesFace == CommonPoints.size()) {
16358 for (iNode = 0; iNode < nNodesFace; iNode++) {
16360 PointFaceFirst.push_back(
elem[first_elem]->GetNode(face_node));
16364 sort( PointFaceFirst.begin(), PointFaceFirst.end());
16367 mypair = mismatch (PointFaceFirst.begin(), PointFaceFirst.end(), CommonPoints.begin());
16368 if (mypair.first == PointFaceFirst.end()) {
16369 face_first_elem = iFace;
16370 face_first_found =
true;
16374 PointFaceFirst.erase (PointFaceFirst.begin(), PointFaceFirst.end());
16379 for (iFace = 0; iFace <
elem[second_elem]->
GetnFaces(); iFace++) {
16382 if (nNodesFace == CommonPoints.size()) {
16383 for (iNode = 0; iNode < nNodesFace; iNode++) {
16384 face_node =
elem[second_elem]->
GetFaces(iFace, iNode);
16385 PointFaceSecond.push_back(
elem[second_elem]->GetNode(face_node));
16389 sort( PointFaceSecond.begin(), PointFaceSecond.end());
16392 mypair = mismatch (PointFaceSecond.begin(), PointFaceSecond.end(), CommonPoints.begin());
16393 if (mypair.first == PointFaceSecond.end()) {
16394 face_second_elem = iFace;
16395 face_second_found =
true;
16399 PointFaceSecond.erase (PointFaceSecond.begin(), PointFaceSecond.end());
16403 if (face_first_found && face_second_found)
return true;
16410 unsigned long iElem, iPoint;
16411 unsigned short iDim;
16412 ofstream Tecplot_File;
16417 Tecplot_File.open(mesh_filename, ios::out);
16418 Tecplot_File <<
"TITLE= \"Visualization of the volumetric grid\"" << endl;
16419 if (
nDim == 2) Tecplot_File <<
"VARIABLES = \"x\",\"y\" " << endl;
16420 if (
nDim == 3) Tecplot_File <<
"VARIABLES = \"x\",\"y\",\"z\" " << endl;
16422 else Tecplot_File.open(mesh_filename, ios::out | ios::app);
16424 Tecplot_File <<
"ZONE T= ";
16425 if (new_file) Tecplot_File <<
"\"Original grid\", C=BLACK, ";
16426 else Tecplot_File <<
"\"Deformed grid\", C=RED, ";
16427 Tecplot_File <<
"NODES= "<<
nPoint <<
", ELEMENTS= "<<
nElem <<
", DATAPACKING= POINT";
16428 if (
nDim == 2) Tecplot_File <<
", ZONETYPE= FEQUADRILATERAL"<< endl;
16429 if (
nDim == 3) Tecplot_File <<
", ZONETYPE= FEBRICK"<< endl;
16433 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
16434 for (iDim = 0; iDim <
nDim; iDim++)
16435 Tecplot_File << scientific <<
node[iPoint]->GetCoord(iDim) <<
"\t";
16436 Tecplot_File <<
"\n";
16441 for (iElem = 0; iElem <
nElem; iElem++) {
16473 if (
elem[iElem]->GetVTK_Type() ==
PRISM) {
16482 Tecplot_File.close();
16487 ofstream Tecplot_File;
16488 unsigned long iPoint, Total_nElem_Bound, iElem, *PointSurface = NULL, nPointSurface = 0;
16489 unsigned short Coord_i, iMarker;
16494 PointSurface =
new unsigned long[
nPoint];
16495 for (iPoint = 0; iPoint <
nPoint; iPoint++)
16496 if (
node[iPoint]->GetBoundary()) {
16497 PointSurface[iPoint] = nPointSurface;
16503 Total_nElem_Bound = 0;
16504 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
16513 Tecplot_File.open(mesh_filename, ios::out);
16514 Tecplot_File <<
"TITLE= \"Visualization of the surface grid\"" << endl;
16515 if (
nDim == 2) Tecplot_File <<
"VARIABLES = \"x\",\"y\" " << endl;
16516 if (
nDim == 3) Tecplot_File <<
"VARIABLES = \"x\",\"y\",\"z\" " << endl;
16518 else Tecplot_File.open(mesh_filename, ios::out | ios::app);
16520 if (Total_nElem_Bound != 0) {
16524 Tecplot_File <<
"ZONE T= ";
16525 if (new_file) Tecplot_File <<
"\"Original grid\", C=BLACK, ";
16526 else Tecplot_File <<
"\"Deformed grid\", C=RED, ";
16527 Tecplot_File <<
"NODES= "<< nPointSurface <<
", ELEMENTS= "<< Total_nElem_Bound <<
", DATAPACKING= POINT";
16528 if (
nDim == 2) Tecplot_File <<
", ZONETYPE= FELINESEG"<< endl;
16529 if (
nDim == 3) Tecplot_File <<
", ZONETYPE= FEQUADRILATERAL"<< endl;
16534 for (iPoint = 0; iPoint <
nPoint; iPoint++)
16535 if (
node[iPoint]->GetBoundary()) {
16536 for (Coord_i = 0; Coord_i <
nDim-1; Coord_i++)
16537 Tecplot_File <<
node[iPoint]->GetCoord(Coord_i) <<
" ";
16542 for (iPoint = 0; iPoint <
nPoint; iPoint++)
16543 if (
node[iPoint]->GetBoundary()) {
16544 for (Coord_i = 0; Coord_i <
nDim; Coord_i++)
16545 Tecplot_File <<
node[iPoint]->GetCoord(Coord_i) <<
" ";
16546 Tecplot_File <<
"\n";
16552 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
16554 for (iElem = 0; iElem <
nElem_Bound[iMarker]; iElem++) {
16556 Tecplot_File << PointSurface[
bound[iMarker][iElem]->
GetNode(0)]+1 <<
" "
16557 << PointSurface[
bound[iMarker][iElem]->
GetNode(1)]+1 << endl;
16560 if (
bound[iMarker][iElem]->GetnNodes() == 3) {
16561 Tecplot_File << PointSurface[
bound[iMarker][iElem]->
GetNode(0)]+1 <<
" "
16562 << PointSurface[
bound[iMarker][iElem]->
GetNode(1)]+1 <<
" "
16563 << PointSurface[
bound[iMarker][iElem]->
GetNode(2)]+1 <<
" "
16564 << PointSurface[
bound[iMarker][iElem]->
GetNode(2)]+1 << endl;
16566 if (
bound[iMarker][iElem]->GetnNodes() == 4) {
16567 Tecplot_File << PointSurface[
bound[iMarker][iElem]->
GetNode(0)]+1 <<
" "
16568 << PointSurface[
bound[iMarker][iElem]->
GetNode(1)]+1 <<
" "
16569 << PointSurface[
bound[iMarker][iElem]->
GetNode(2)]+1 <<
" "
16570 << PointSurface[
bound[iMarker][iElem]->
GetNode(3)]+1 << endl;
16580 Tecplot_File <<
"ZONE NODES= 1, ELEMENTS= 1, DATAPACKING=POINT, ZONETYPE=FELINESEG"<< endl;
16581 Tecplot_File <<
"0.0 0.0"<< endl;
16582 Tecplot_File <<
"1 1"<< endl;
16585 Tecplot_File <<
"ZONE NODES= 1, ELEMENTS= 1, DATAPACKING=POINT, ZONETYPE=FEQUADRILATERAL"<< endl;
16586 Tecplot_File <<
"0.0 0.0 0.0"<< endl;
16587 Tecplot_File <<
"1 1 1 1"<< endl;
16593 delete[] PointSurface;
16594 Tecplot_File.close();
16603 unsigned long iPoint, iElem, iElem_Triangle, iElem_Tetrahedron, nElem_Triangle,
16605 idx_t ne = 0, nn, *elmnts = NULL, *epart = NULL, *npart = NULL, nparts, edgecut, *eptr;
16608 cout << endl <<
"---------------------------- Grid partitioning --------------------------" << endl;
16610 unsigned short nDomain =
size;
16612 nElem_Triangle = 0;
16613 nElem_Tetrahedron = 0;
16614 for (iElem = 0; iElem <
GetnElem(); iElem++) {
16615 if (
elem[iElem]->GetVTK_Type() ==
TRIANGLE) nElem_Triangle = nElem_Triangle + 1;
16616 if (
elem[iElem]->GetVTK_Type() ==
QUADRILATERAL) nElem_Triangle = nElem_Triangle + 2;
16617 if (
elem[iElem]->GetVTK_Type() ==
TETRAHEDRON) nElem_Tetrahedron = nElem_Tetrahedron + 1;
16618 if (
elem[iElem]->GetVTK_Type() ==
HEXAHEDRON) nElem_Tetrahedron = nElem_Tetrahedron + 5;
16619 if (
elem[iElem]->GetVTK_Type() ==
PYRAMID) nElem_Tetrahedron = nElem_Tetrahedron + 2;
16620 if (
elem[iElem]->GetVTK_Type() ==
PRISM) nElem_Tetrahedron = nElem_Tetrahedron + 3;
16624 ne = nElem_Triangle;
16625 elmnts =
new idx_t [ne*3];
16628 ne = nElem_Tetrahedron;
16629 elmnts =
new idx_t [ne*4];
16634 epart =
new idx_t [ne];
16635 npart =
new idx_t [nn];
16636 eptr =
new idx_t[ne+1];
16640 for (iPoint = 0; iPoint <
nPoint; iPoint++)
16641 node[iPoint]->SetColor(0);
16645 iElem_Triangle = 0; iElem_Tetrahedron = 0;
16646 for (iElem = 0; iElem <
GetnElem(); iElem++) {
16648 elmnts[3*iElem_Triangle+0]=
elem[iElem]->
GetNode(0);
16649 elmnts[3*iElem_Triangle+1]=
elem[iElem]->
GetNode(1);
16650 elmnts[3*iElem_Triangle+2]=
elem[iElem]->
GetNode(2);
16651 eptr[iElem_Triangle] = 3*iElem_Triangle;
16655 elmnts[3*iElem_Triangle+0]=
elem[iElem]->
GetNode(0);
16656 elmnts[3*iElem_Triangle+1]=
elem[iElem]->
GetNode(1);
16657 elmnts[3*iElem_Triangle+2]=
elem[iElem]->
GetNode(2);
16658 eptr[iElem_Triangle] = 3*iElem_Triangle;
16660 elmnts[3*iElem_Triangle+0]=
elem[iElem]->
GetNode(0);
16661 elmnts[3*iElem_Triangle+1]=
elem[iElem]->
GetNode(2);
16662 elmnts[3*iElem_Triangle+2]=
elem[iElem]->
GetNode(3);
16663 eptr[iElem_Triangle] = 3*iElem_Triangle;
16667 elmnts[4*iElem_Tetrahedron+0]=
elem[iElem]->
GetNode(0);
16668 elmnts[4*iElem_Tetrahedron+1]=
elem[iElem]->
GetNode(1);
16669 elmnts[4*iElem_Tetrahedron+2]=
elem[iElem]->
GetNode(2);
16670 elmnts[4*iElem_Tetrahedron+3]=
elem[iElem]->
GetNode(3);
16671 eptr[iElem_Tetrahedron] = 4*iElem_Tetrahedron;
16672 iElem_Tetrahedron++;
16675 elmnts[4*iElem_Tetrahedron+0]=
elem[iElem]->
GetNode(0);
16676 elmnts[4*iElem_Tetrahedron+1]=
elem[iElem]->
GetNode(1);
16677 elmnts[4*iElem_Tetrahedron+2]=
elem[iElem]->
GetNode(2);
16678 elmnts[4*iElem_Tetrahedron+3]=
elem[iElem]->
GetNode(5);
16679 eptr[iElem_Tetrahedron] = 4*iElem_Tetrahedron;
16680 iElem_Tetrahedron++;
16681 elmnts[4*iElem_Tetrahedron+0]=
elem[iElem]->
GetNode(0);
16682 elmnts[4*iElem_Tetrahedron+1]=
elem[iElem]->
GetNode(2);
16683 elmnts[4*iElem_Tetrahedron+2]=
elem[iElem]->
GetNode(3);
16684 elmnts[4*iElem_Tetrahedron+3]=
elem[iElem]->
GetNode(7);
16685 eptr[iElem_Tetrahedron] = 4*iElem_Tetrahedron;
16686 iElem_Tetrahedron++;
16687 elmnts[4*iElem_Tetrahedron+0]=
elem[iElem]->
GetNode(0);
16688 elmnts[4*iElem_Tetrahedron+1]=
elem[iElem]->
GetNode(5);
16689 elmnts[4*iElem_Tetrahedron+2]=
elem[iElem]->
GetNode(7);
16690 elmnts[4*iElem_Tetrahedron+3]=
elem[iElem]->
GetNode(4);
16691 eptr[iElem_Tetrahedron] = 4*iElem_Tetrahedron;
16692 iElem_Tetrahedron++;
16693 elmnts[4*iElem_Tetrahedron+0]=
elem[iElem]->
GetNode(2);
16694 elmnts[4*iElem_Tetrahedron+1]=
elem[iElem]->
GetNode(7);
16695 elmnts[4*iElem_Tetrahedron+2]=
elem[iElem]->
GetNode(5);
16696 elmnts[4*iElem_Tetrahedron+3]=
elem[iElem]->
GetNode(6);
16697 eptr[iElem_Tetrahedron] = 4*iElem_Tetrahedron;
16698 iElem_Tetrahedron++;
16699 elmnts[4*iElem_Tetrahedron+0]=
elem[iElem]->
GetNode(0);
16700 elmnts[4*iElem_Tetrahedron+1]=
elem[iElem]->
GetNode(2);
16701 elmnts[4*iElem_Tetrahedron+2]=
elem[iElem]->
GetNode(7);
16702 elmnts[4*iElem_Tetrahedron+3]=
elem[iElem]->
GetNode(5);
16703 eptr[iElem_Tetrahedron] = 4*iElem_Tetrahedron;
16704 iElem_Tetrahedron++;
16707 elmnts[4*iElem_Tetrahedron+0]=
elem[iElem]->
GetNode(0);
16708 elmnts[4*iElem_Tetrahedron+1]=
elem[iElem]->
GetNode(1);
16709 elmnts[4*iElem_Tetrahedron+2]=
elem[iElem]->
GetNode(2);
16710 elmnts[4*iElem_Tetrahedron+3]=
elem[iElem]->
GetNode(4);
16711 eptr[iElem_Tetrahedron] = 4*iElem_Tetrahedron;
16712 iElem_Tetrahedron++;
16713 elmnts[4*iElem_Tetrahedron+0]=
elem[iElem]->
GetNode(0);
16714 elmnts[4*iElem_Tetrahedron+1]=
elem[iElem]->
GetNode(2);
16715 elmnts[4*iElem_Tetrahedron+2]=
elem[iElem]->
GetNode(3);
16716 elmnts[4*iElem_Tetrahedron+3]=
elem[iElem]->
GetNode(4);
16717 eptr[iElem_Tetrahedron] = 4*iElem_Tetrahedron;
16718 iElem_Tetrahedron++;
16720 if (
elem[iElem]->GetVTK_Type() ==
PRISM) {
16721 elmnts[4*iElem_Tetrahedron+0]=
elem[iElem]->
GetNode(0);
16722 elmnts[4*iElem_Tetrahedron+1]=
elem[iElem]->
GetNode(1);
16723 elmnts[4*iElem_Tetrahedron+2]=
elem[iElem]->
GetNode(4);
16724 elmnts[4*iElem_Tetrahedron+3]=
elem[iElem]->
GetNode(2);
16725 eptr[iElem_Tetrahedron] = 4*iElem_Tetrahedron;
16726 iElem_Tetrahedron++;
16727 elmnts[4*iElem_Tetrahedron+0]=
elem[iElem]->
GetNode(0);
16728 elmnts[4*iElem_Tetrahedron+1]=
elem[iElem]->
GetNode(2);
16729 elmnts[4*iElem_Tetrahedron+2]=
elem[iElem]->
GetNode(3);
16730 elmnts[4*iElem_Tetrahedron+3]=
elem[iElem]->
GetNode(4);
16731 eptr[iElem_Tetrahedron] = 4*iElem_Tetrahedron;
16732 iElem_Tetrahedron++;
16733 elmnts[4*iElem_Tetrahedron+0]=
elem[iElem]->
GetNode(3);
16734 elmnts[4*iElem_Tetrahedron+1]=
elem[iElem]->
GetNode(4);
16735 elmnts[4*iElem_Tetrahedron+2]=
elem[iElem]->
GetNode(5);
16736 elmnts[4*iElem_Tetrahedron+3]=
elem[iElem]->
GetNode(2);
16737 eptr[iElem_Tetrahedron] = 4*iElem_Tetrahedron;
16738 iElem_Tetrahedron++;
16744 if (
GetnDim() == 2) eptr[ne] = 3*ne;
16745 else eptr[ne] = 4*ne;
16747 METIS_PartMeshNodal(&ne, &nn, eptr, elmnts, NULL, NULL, &nparts, NULL, NULL, &edgecut, epart, npart);
16749 cout <<
"Finished partitioning using METIS. (" << edgecut <<
" edge cuts)." << endl;
16751 for (iPoint = 0; iPoint <
nPoint; iPoint++)
16752 node[iPoint]->SetColor(npart[iPoint]);
16770 for (
unsigned long iPoint = 0; iPoint <
nPoint; iPoint++)
16771 node[iPoint]->SetColor(0);
16777 #ifdef HAVE_PARMETIS
16779 unsigned long iPoint;
16788 idx_t numflag, nparts, edgecut, wgtflag, ncon;
16790 idx_t *vtxdist =
new idx_t[
size+1];
16791 idx_t *part =
new idx_t[
nPoint];
16794 real_t *tpwgts =
new real_t[
size];
16802 nparts = (idx_t)
size;
16803 idx_t options[METIS_NOPTIONS];
16804 METIS_SetDefaultOptions(options);
16811 for (
int i = 0; i <
size; i++) {
16812 tpwgts[i] = 1.0/((real_t)
size);
16816 for (
int i = 0; i <
size; i++) {
16822 ParMETIS_V3_PartKway(vtxdist,xadj, adjacency, NULL, NULL, &wgtflag,
16823 &numflag, &ncon, &nparts, tpwgts, &ubvec, options,
16824 &edgecut, part, &comm);
16826 cout <<
" graph partitioning complete (";
16827 cout << edgecut <<
" edge cuts)." << endl;
16834 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
16850 delete [] adjacency;
16858 unsigned long jPoint, Point_2, Point_3, iElem;
16859 su2double *Coord_j, *Coord_2, *Coord_3;
16860 unsigned short iDim;
16862 statistics[0] = 1e06;
16866 for (iElem = 0; iElem < this->
GetnElem(); iElem++) {
16876 for (iDim = 0; iDim <
nDim; iDim++) {
16877 a += (Coord_2[iDim]-Coord_j[iDim])*(Coord_2[iDim]-Coord_j[iDim]);
16878 b += (Coord_3[iDim]-Coord_j[iDim])*(Coord_3[iDim]-Coord_j[iDim]);
16879 c += (Coord_3[iDim]-Coord_2[iDim])*(Coord_3[iDim]-Coord_2[iDim]);
16881 a = sqrt(a); b = sqrt(b); c = sqrt(c);
16885 su2double Area = sqrt(s*(s-a)*(s-b)*(s-c));
16893 if (roR < statistics[0])
16894 statistics[0] = roR;
16895 statistics[1] += roR;
16899 statistics[1] /= this->
GetnElem();
16905 unsigned long iPoint;
16906 su2double RotVel[3], Distance[3], *Coord, Center[3], Omega[3], L_Ref;
16921 cout <<
" Rotational origin (x, y, z): ( " << Center[0] <<
", " << Center[1];
16922 cout <<
", " << Center[2] <<
" )" << endl;
16923 cout <<
" Angular velocity about x, y, z axes: ( " << Omega[0] <<
", ";
16924 cout << Omega[1] <<
", " << Omega[2] <<
" ) rad/s" << endl;
16929 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
16937 Distance[0] = (Coord[0]-Center[0])/L_Ref;
16938 Distance[1] = (Coord[1]-Center[1])/L_Ref;
16941 Distance[2] = (Coord[2]-Center[2])/L_Ref;
16945 RotVel[0] = Omega[1]*(Distance[2]) - Omega[2]*(Distance[1]);
16946 RotVel[1] = Omega[2]*(Distance[0]) - Omega[0]*(Distance[2]);
16949 RotVel[2] = Omega[0]*(Distance[1]) - Omega[1]*(Distance[0]);
16961 unsigned long iPoint, iVertex;
16962 unsigned short iMarker, iMarkerShroud;
16970 for (iMarker = 0; iMarker <
nMarker; iMarker++){
16971 for(iMarkerShroud=0; iMarkerShroud < config->
GetnMarker_Shroud(); iMarkerShroud++){
16973 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
16984 unsigned short iDim;
16985 unsigned long iPoint;
16997 cout <<
" Non-dim. translational velocity: (" << xDot[0] <<
", " << xDot[1];
16998 cout <<
", " << xDot[2] <<
")." << endl;
17003 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
17007 for (iDim = 0; iDim <
nDim; iDim++) {
17019 su2double *Coord_nP1 = NULL, *Coord_n = NULL, *Coord_nM1 = NULL;
17021 unsigned long iPoint;
17022 unsigned short iDim;
17026 for (iPoint = 0; iPoint <
GetnPoint(); iPoint++) {
17040 for (iDim = 0; iDim <
nDim; iDim++) {
17042 GridVel = ( Coord_nP1[iDim] - Coord_n[iDim] ) / TimeStep;
17044 GridVel = ( 3.0*Coord_nP1[iDim] - 4.0*Coord_n[iDim]
17045 + 1.0*Coord_nM1[iDim] ) / (2.0*TimeStep);
17057 unsigned short iDim, iMarker, iPeriodic_Index, MarkerS, MarkerR;
17058 unsigned long iVertex, iPoint, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector;
17059 su2double rotMatrix[3][3], *angles, theta, cosTheta, sinTheta, phi, cosPhi, sinPhi, psi, cosPsi, sinPsi, *Buffer_Receive_Coord = NULL, *Buffer_Send_Coord = NULL, *Coord = NULL, *newCoord = NULL;
17064 int send_to, receive_from;
17068 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
17073 MarkerS = iMarker; MarkerR = iMarker+1;
17081 nBufferS_Vector = nVertexS*
nDim; nBufferR_Vector = nVertexR*
nDim;
17085 Buffer_Receive_Coord =
new su2double [nBufferR_Vector];
17086 Buffer_Send_Coord =
new su2double[nBufferS_Vector];
17090 for (iVertex = 0; iVertex < nVertexS; iVertex++) {
17093 for (iDim = 0; iDim <
nDim; iDim++)
17094 Buffer_Send_Coord[iDim*nVertexS+iVertex] = Coord[iDim];
17104 for (iVertex = 0; iVertex < nVertexR; iVertex++) {
17105 for (iDim = 0; iDim <
nDim; iDim++)
17106 Buffer_Receive_Coord[iDim*nVertexR+iVertex] = Buffer_Send_Coord[iDim*nVertexR+iVertex];
17113 delete [] Buffer_Send_Coord;
17117 for (iVertex = 0; iVertex < nVertexR; iVertex++) {
17131 theta = angles[0]; phi = angles[1]; psi = angles[2];
17132 cosTheta = cos(theta); cosPhi = cos(phi); cosPsi = cos(psi);
17133 sinTheta = sin(theta); sinPhi = sin(phi); sinPsi = sin(psi);
17140 rotMatrix[0][0] = cosPhi*cosPsi; rotMatrix[1][0] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi; rotMatrix[2][0] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
17141 rotMatrix[0][1] = cosPhi*sinPsi; rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi; rotMatrix[2][1] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
17142 rotMatrix[0][2] = -sinPhi; rotMatrix[1][2] = sinTheta*cosPhi; rotMatrix[2][2] = cosTheta*cosPhi;
17146 for (iDim = 0; iDim <
nDim; iDim++)
17147 newCoord[iDim] = Buffer_Receive_Coord[iDim*nVertexR+iVertex];
17152 newCoord[0] = (rotMatrix[0][0]*Buffer_Receive_Coord[0*nVertexR+iVertex] +
17153 rotMatrix[0][1]*Buffer_Receive_Coord[1*nVertexR+iVertex]) - translation[0];
17154 newCoord[1] = (rotMatrix[1][0]*Buffer_Receive_Coord[0*nVertexR+iVertex] +
17155 rotMatrix[1][1]*Buffer_Receive_Coord[1*nVertexR+iVertex]) - translation[1];
17158 newCoord[0] = (rotMatrix[0][0]*Buffer_Receive_Coord[0*nVertexR+iVertex] +
17159 rotMatrix[0][1]*Buffer_Receive_Coord[1*nVertexR+iVertex] +
17160 rotMatrix[0][2]*Buffer_Receive_Coord[2*nVertexR+iVertex]);
17161 newCoord[1] = (rotMatrix[1][0]*Buffer_Receive_Coord[0*nVertexR+iVertex] +
17162 rotMatrix[1][1]*Buffer_Receive_Coord[1*nVertexR+iVertex] +
17163 rotMatrix[1][2]*Buffer_Receive_Coord[2*nVertexR+iVertex]);
17164 newCoord[2] = (rotMatrix[2][0]*Buffer_Receive_Coord[0*nVertexR+iVertex] +
17165 rotMatrix[2][1]*Buffer_Receive_Coord[1*nVertexR+iVertex] +
17166 rotMatrix[2][2]*Buffer_Receive_Coord[2*nVertexR+iVertex]);
17171 for (iDim = 0; iDim <
nDim; iDim++)
17178 delete [] Buffer_Receive_Coord;
17184 delete [] newCoord;
17190 unsigned short iDim, iMarker, iPeriodic_Index, MarkerS, MarkerR;
17191 unsigned long iVertex, iPoint, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector;
17192 su2double rotMatrix[3][3], *angles, theta, cosTheta, sinTheta, phi, cosPhi, sinPhi, psi, cosPsi, sinPsi, *Buffer_Receive_GridVel = NULL, *Buffer_Send_GridVel = NULL, *GridVel = NULL, *newGridVel = NULL;
17197 int send_to, receive_from;
17201 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
17206 MarkerS = iMarker; MarkerR = iMarker+1;
17214 nBufferS_Vector = nVertexS*
nDim; nBufferR_Vector = nVertexR*
nDim;
17218 Buffer_Receive_GridVel =
new su2double [nBufferR_Vector];
17219 Buffer_Send_GridVel =
new su2double[nBufferS_Vector];
17223 for (iVertex = 0; iVertex < nVertexS; iVertex++) {
17226 for (iDim = 0; iDim <
nDim; iDim++)
17227 Buffer_Send_GridVel[iDim*nVertexS+iVertex] = GridVel[iDim];
17237 for (iVertex = 0; iVertex < nVertexR; iVertex++) {
17238 for (iDim = 0; iDim <
nDim; iDim++)
17239 Buffer_Receive_GridVel[iDim*nVertexR+iVertex] = Buffer_Send_GridVel[iDim*nVertexR+iVertex];
17246 delete [] Buffer_Send_GridVel;
17250 for (iVertex = 0; iVertex < nVertexR; iVertex++) {
17262 theta = angles[0]; phi = angles[1]; psi = angles[2];
17263 cosTheta = cos(theta); cosPhi = cos(phi); cosPsi = cos(psi);
17264 sinTheta = sin(theta); sinPhi = sin(phi); sinPsi = sin(psi);
17271 rotMatrix[0][0] = cosPhi*cosPsi; rotMatrix[1][0] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi; rotMatrix[2][0] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
17272 rotMatrix[0][1] = cosPhi*sinPsi; rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi; rotMatrix[2][1] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
17273 rotMatrix[0][2] = -sinPhi; rotMatrix[1][2] = sinTheta*cosPhi; rotMatrix[2][2] = cosTheta*cosPhi;
17277 for (iDim = 0; iDim <
nDim; iDim++)
17278 newGridVel[iDim] = Buffer_Receive_GridVel[iDim*nVertexR+iVertex];
17281 newGridVel[0] = (rotMatrix[0][0]*Buffer_Receive_GridVel[0*nVertexR+iVertex] +
17282 rotMatrix[0][1]*Buffer_Receive_GridVel[1*nVertexR+iVertex]);
17283 newGridVel[1] = (rotMatrix[1][0]*Buffer_Receive_GridVel[0*nVertexR+iVertex] +
17284 rotMatrix[1][1]*Buffer_Receive_GridVel[1*nVertexR+iVertex]);
17287 newGridVel[0] = (rotMatrix[0][0]*Buffer_Receive_GridVel[0*nVertexR+iVertex] +
17288 rotMatrix[0][1]*Buffer_Receive_GridVel[1*nVertexR+iVertex] +
17289 rotMatrix[0][2]*Buffer_Receive_GridVel[2*nVertexR+iVertex]);
17290 newGridVel[1] = (rotMatrix[1][0]*Buffer_Receive_GridVel[0*nVertexR+iVertex] +
17291 rotMatrix[1][1]*Buffer_Receive_GridVel[1*nVertexR+iVertex] +
17292 rotMatrix[1][2]*Buffer_Receive_GridVel[2*nVertexR+iVertex]);
17293 newGridVel[2] = (rotMatrix[2][0]*Buffer_Receive_GridVel[0*nVertexR+iVertex] +
17294 rotMatrix[2][1]*Buffer_Receive_GridVel[1*nVertexR+iVertex] +
17295 rotMatrix[2][2]*Buffer_Receive_GridVel[2*nVertexR+iVertex]);
17300 for (iDim = 0; iDim <
nDim; iDim++)
17301 node[iPoint]->SetGridVel(iDim, newGridVel[iDim]);
17307 delete [] Buffer_Receive_GridVel;
17313 delete [] newGridVel;
17319 unsigned short iDim, iMarker, iPeriodic_Index, MarkerS, MarkerR;
17320 unsigned long iVertex, iPoint, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector;
17321 su2double rotMatrix[3][3], *angles, theta, cosTheta, sinTheta, phi, cosPhi, sinPhi, psi, cosPsi, sinPsi;
17323 su2double *Buffer_Receive_Coord_n = NULL, *Buffer_Send_Coord_n = NULL, *Coord_n = NULL, *newCoord_n = NULL;
17328 int send_to, receive_from;
17332 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
17337 MarkerS = iMarker; MarkerR = iMarker+1;
17345 nBufferS_Vector = nVertexS*
nDim; nBufferR_Vector = nVertexR*
nDim;
17349 Buffer_Receive_Coord_n =
new su2double [nBufferR_Vector];
17350 Buffer_Send_Coord_n =
new su2double[nBufferS_Vector];
17354 for (iVertex = 0; iVertex < nVertexS; iVertex++) {
17357 for (iDim = 0; iDim <
nDim; iDim++)
17358 Buffer_Send_Coord_n[iDim*nVertexS+iVertex] = Coord_n[iDim];
17368 for (iVertex = 0; iVertex < nVertexR; iVertex++) {
17369 for (iDim = 0; iDim <
nDim; iDim++)
17370 Buffer_Receive_Coord_n[iDim*nVertexR+iVertex] = Buffer_Send_Coord_n[iDim*nVertexR+iVertex];
17377 delete [] Buffer_Send_Coord_n;
17381 for (iVertex = 0; iVertex < nVertexR; iVertex++) {
17394 theta = angles[0]; phi = angles[1]; psi = angles[2];
17395 cosTheta = cos(theta); cosPhi = cos(phi); cosPsi = cos(psi);
17396 sinTheta = sin(theta); sinPhi = sin(phi); sinPsi = sin(psi);
17403 rotMatrix[0][0] = cosPhi*cosPsi; rotMatrix[1][0] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi; rotMatrix[2][0] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
17404 rotMatrix[0][1] = cosPhi*sinPsi; rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi; rotMatrix[2][1] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
17405 rotMatrix[0][2] = -sinPhi; rotMatrix[1][2] = sinTheta*cosPhi; rotMatrix[2][2] = cosTheta*cosPhi;
17409 for (iDim = 0; iDim <
nDim; iDim++)
17410 newCoord_n[iDim] = Buffer_Receive_Coord_n[iDim*nVertexR+iVertex];
17415 newCoord_n[0] = (rotMatrix[0][0]*Buffer_Receive_Coord_n[0*nVertexR+iVertex] +
17416 rotMatrix[0][1]*Buffer_Receive_Coord_n[1*nVertexR+iVertex]);
17417 newCoord_n[1] = (rotMatrix[1][0]*Buffer_Receive_Coord_n[0*nVertexR+iVertex] +
17418 rotMatrix[1][1]*Buffer_Receive_Coord_n[1*nVertexR+iVertex]);
17421 newCoord_n[0] = (rotMatrix[0][0]*Buffer_Receive_Coord_n[0*nVertexR+iVertex] +
17422 rotMatrix[0][1]*Buffer_Receive_Coord_n[1*nVertexR+iVertex] +
17423 rotMatrix[0][2]*Buffer_Receive_Coord_n[2*nVertexR+iVertex]);
17424 newCoord_n[1] = (rotMatrix[1][0]*Buffer_Receive_Coord_n[0*nVertexR+iVertex] +
17425 rotMatrix[1][1]*Buffer_Receive_Coord_n[1*nVertexR+iVertex] +
17426 rotMatrix[1][2]*Buffer_Receive_Coord_n[2*nVertexR+iVertex]);
17427 newCoord_n[2] = (rotMatrix[2][0]*Buffer_Receive_Coord_n[0*nVertexR+iVertex] +
17428 rotMatrix[2][1]*Buffer_Receive_Coord_n[1*nVertexR+iVertex] +
17429 rotMatrix[2][2]*Buffer_Receive_Coord_n[2*nVertexR+iVertex]);
17440 delete [] Buffer_Receive_Coord_n;
17446 delete [] newCoord_n;
17454 su2double *Buffer_Receive_Coord_n1 = NULL, *Buffer_Send_Coord_n1 = NULL, *Coord_n1 = NULL, *newCoord_n1 = NULL;
17457 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
17462 MarkerS = iMarker; MarkerR = iMarker+1;
17470 nBufferS_Vector = nVertexS*
nDim; nBufferR_Vector = nVertexR*
nDim;
17474 Buffer_Receive_Coord_n1 =
new su2double [nBufferR_Vector];
17475 Buffer_Send_Coord_n1 =
new su2double[nBufferS_Vector];
17479 for (iVertex = 0; iVertex < nVertexS; iVertex++) {
17482 for (iDim = 0; iDim <
nDim; iDim++)
17483 Buffer_Send_Coord_n1[iDim*nVertexS+iVertex] = Coord_n1[iDim];
17493 for (iVertex = 0; iVertex < nVertexR; iVertex++) {
17494 for (iDim = 0; iDim <
nDim; iDim++)
17495 Buffer_Receive_Coord_n1[iDim*nVertexR+iVertex] = Buffer_Send_Coord_n1[iDim*nVertexR+iVertex];
17502 delete [] Buffer_Send_Coord_n1;
17506 for (iVertex = 0; iVertex < nVertexR; iVertex++) {
17519 theta = angles[0]; phi = angles[1]; psi = angles[2];
17520 cosTheta = cos(theta); cosPhi = cos(phi); cosPsi = cos(psi);
17521 sinTheta = sin(theta); sinPhi = sin(phi); sinPsi = sin(psi);
17528 rotMatrix[0][0] = cosPhi*cosPsi; rotMatrix[1][0] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi; rotMatrix[2][0] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
17529 rotMatrix[0][1] = cosPhi*sinPsi; rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi; rotMatrix[2][1] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
17530 rotMatrix[0][2] = -sinPhi; rotMatrix[1][2] = sinTheta*cosPhi; rotMatrix[2][2] = cosTheta*cosPhi;
17534 for (iDim = 0; iDim <
nDim; iDim++)
17535 newCoord_n1[iDim] = Buffer_Receive_Coord_n1[iDim*nVertexR+iVertex];
17540 newCoord_n1[0] = (rotMatrix[0][0]*Buffer_Receive_Coord_n1[0*nVertexR+iVertex] +
17541 rotMatrix[0][1]*Buffer_Receive_Coord_n1[1*nVertexR+iVertex]);
17542 newCoord_n1[1] = (rotMatrix[1][0]*Buffer_Receive_Coord_n1[0*nVertexR+iVertex] +
17543 rotMatrix[1][1]*Buffer_Receive_Coord_n1[1*nVertexR+iVertex]);
17546 newCoord_n1[0] = (rotMatrix[0][0]*Buffer_Receive_Coord_n1[0*nVertexR+iVertex] +
17547 rotMatrix[0][1]*Buffer_Receive_Coord_n1[1*nVertexR+iVertex] +
17548 rotMatrix[0][2]*Buffer_Receive_Coord_n1[2*nVertexR+iVertex]);
17549 newCoord_n1[1] = (rotMatrix[1][0]*Buffer_Receive_Coord_n1[0*nVertexR+iVertex] +
17550 rotMatrix[1][1]*Buffer_Receive_Coord_n1[1*nVertexR+iVertex] +
17551 rotMatrix[1][2]*Buffer_Receive_Coord_n1[2*nVertexR+iVertex]);
17552 newCoord_n1[2] = (rotMatrix[2][0]*Buffer_Receive_Coord_n1[0*nVertexR+iVertex] +
17553 rotMatrix[2][1]*Buffer_Receive_Coord_n1[1*nVertexR+iVertex] +
17554 rotMatrix[2][2]*Buffer_Receive_Coord_n1[2*nVertexR+iVertex]);
17565 delete [] Buffer_Receive_Coord_n1;
17571 delete [] newCoord_n1;
17581 unsigned short iMarker, MarkerS, MarkerR;
17582 unsigned long iVertex, iPoint, nVertexS, nVertexR, nBufferS, nBufferR;
17583 su2double *Buffer_Receive = NULL, *Buffer_Send = NULL;
17586 int send_to, receive_from;
17590 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
17595 MarkerS = iMarker; MarkerR = iMarker+1;
17603 nBufferS = nVertexS; nBufferR = nVertexR;
17607 Buffer_Receive =
new su2double [nBufferR];
17612 for (iVertex = 0; iVertex < nVertexS; iVertex++) {
17615 Buffer_Send[iVertex] = max_length;
17621 Buffer_Receive, nBufferR,
MPI_DOUBLE, receive_from, 0,
17626 for (iVertex = 0; iVertex < nVertexR; iVertex++) {
17627 Buffer_Receive[iVertex] = Buffer_Send[iVertex];
17634 delete [] Buffer_Send;
17637 for (iVertex = 0; iVertex < nVertexR; iVertex++) {
17644 delete [] Buffer_Receive;
17654 unsigned short iMarker, jMarker, kMarker = 0, iPeriodic, iDim, nPeriodic = 0, VTK_Type;
17655 unsigned long iNode, iIndex, iVertex, iPoint, iElem, kElem;
17656 unsigned long jElem, kPoint = 0, jVertex = 0, jPoint = 0, pPoint = 0, nPointPeriodic, newNodes[4] = {0,0,0,0};
17658 su2double *center, *angles, rotMatrix[3][3] = {{0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}},
17659 translation[3], *trans, theta, phi, psi, cosTheta, sinTheta, cosPhi, sinPhi, cosPsi, sinPsi,
17660 dx, dy, dz, rotCoord[3], epsilon = 1e-10, mindist = 1e6, *Coord_i, *Coord_j, dist = 0.0;
17661 bool isBadMatch =
false;
17665 vector<unsigned long> OldBoundaryElems[100];
17666 vector<unsigned long>::iterator IterNewElem[100];
17669 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
17675 bool *CreateMirror =
new bool[nPeriodic+1];
17676 CreateMirror[0] =
false;
17677 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++) {
17678 if (iPeriodic <= nPeriodic/2) CreateMirror[iPeriodic] =
false;
17679 else CreateMirror[iPeriodic] =
true;
17683 cout <<
"Setting the periodic boundary conditions." << endl;
17686 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
17702 translation[0] = center[0] + trans[0];
17703 translation[1] = center[1] + trans[1];
17704 translation[2] = center[2] + trans[2];
17711 cosTheta = cos(theta); cosPhi = cos(phi); cosPsi = cos(psi);
17712 sinTheta = sin(theta); sinPhi = sin(phi); sinPsi = sin(psi);
17716 rotMatrix[0][0] = cosPhi*cosPsi;
17717 rotMatrix[1][0] = cosPhi*sinPsi;
17718 rotMatrix[2][0] = -sinPhi;
17720 rotMatrix[0][1] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi;
17721 rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi;
17722 rotMatrix[2][1] = sinTheta*cosPhi;
17724 rotMatrix[0][2] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
17725 rotMatrix[1][2] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
17726 rotMatrix[2][2] = cosTheta*cosPhi;
17729 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
17736 dx = Coord_i[0] - center[0];
17737 dy = Coord_i[1] - center[1];
17739 dz = Coord_i[2] - center[2];
17745 rotCoord[0] = rotMatrix[0][0]*dx
17746 + rotMatrix[0][1]*dy
17747 + rotMatrix[0][2]*dz + translation[0];
17749 rotCoord[1] = rotMatrix[1][0]*dx
17750 + rotMatrix[1][1]*dy
17751 + rotMatrix[1][2]*dz + translation[1];
17753 rotCoord[2] = rotMatrix[2][0]*dx
17754 + rotMatrix[2][1]*dy
17755 + rotMatrix[2][2]*dz + translation[2];
17759 for (jVertex = 0; jVertex <
nVertex[jMarker]; jVertex++) {
17768 for (iDim = 0; iDim <
nDim; iDim++) {
17769 dist += (Coord_j[iDim]-rotCoord[iDim])*(Coord_j[iDim]-rotCoord[iDim]);
17775 if (dist < mindist) { mindist = dist; pPoint = jPoint; }
17783 if (mindist > epsilon) {
17785 cout.precision(10);
17787 cout <<
" Bad match for point " << iPoint <<
".\tNearest";
17788 cout <<
" donor distance: " << scientific << mindist <<
".";
17795 cout <<
"\n !!! Warning !!!" << endl;
17796 cout <<
"Bad matches found. Computation will continue, but be cautious.\n";
17799 isBadMatch =
false;
17804 bool *PeriodicBC =
new bool [
nPoint];
17805 for (iPoint = 0; iPoint <
nPoint; iPoint++) PeriodicBC[iPoint] =
false;
17807 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
17809 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
17811 PeriodicBC[iPoint] =
true;
17816 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
17821 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
17829 if (CreateMirror[iPeriodic]) {
17834 for (iIndex = 0; iIndex <
node[jPoint]->
GetnElem(); iIndex++) {
17837 for (
unsigned short iNode = 0; iNode <
elem[iElem]->
GetnNodes(); iNode ++) {
17839 if (!PeriodicBC[kPoint])
PeriodicPoint[iPeriodic][0].push_back(kPoint);
17853 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++) {
17854 if (CreateMirror[iPeriodic]) {
17862 nPointPeriodic =
nPoint;
17863 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++) {
17864 if (CreateMirror[iPeriodic]) {
17865 for (iPoint = 0; iPoint <
PeriodicPoint[iPeriodic][0].size(); iPoint++) {
17874 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++) {
17875 if (CreateMirror[iPeriodic]) {
17883 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
17884 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
17890 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++) {
17891 if (CreateMirror[iPeriodic]) {
17894 for (iElem = 0; iElem <
PeriodicPoint[iPeriodic][0].size(); iElem++) {
17900 if (iPoint == jPoint) {
17906 bool isJPoint, isPeriodic;
17907 for (jElem = 0; jElem <
nElem_Bound[iMarker]; jElem++) {
17908 isJPoint =
false; isPeriodic =
false;
17909 for (iNode = 0; iNode <
bound[iMarker][jElem]->
GetnNodes(); iNode++) {
17910 if (
bound[iMarker][jElem]->GetNode(iNode) == jPoint) isJPoint =
true;
17911 if (PeriodicBC[
bound[iMarker][jElem]->GetNode(iNode)]) isPeriodic =
true;
17915 if (isJPoint && isPeriodic) {
17916 OldBoundaryElems[iMarker].push_back(jElem);
17929 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
17930 sort( OldBoundaryElems[iMarker].begin(), OldBoundaryElems[iMarker].end());
17931 IterNewElem[iMarker] = unique( OldBoundaryElems[iMarker].begin(), OldBoundaryElems[iMarker].end());
17932 OldBoundaryElems[iMarker].resize( IterNewElem[iMarker] - OldBoundaryElems[iMarker].begin() );
17939 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
17946 jElem = OldBoundaryElems[iMarker][iElem];
17949 for (iNode = 0; iNode <
bound[iMarker][jElem]->
GetnNodes(); iNode++) {
17954 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++) {
17955 for (kElem = 0; kElem <
PeriodicPoint[iPeriodic][0].size(); kElem++) {
17962 if (PeriodicBC[pPoint]) {
17965 for (jMarker = 0; jMarker < config->
GetnMarker_All(); jMarker++) {
17967 for (iVertex = 0; iVertex <
nVertex[jMarker]; iVertex++) {
17968 if (pPoint ==
vertex[jMarker][iVertex]->GetNode()) {kMarker = jMarker; jVertex = iVertex;}
17980 newBound[iMarker][iElem] =
new CLine(newNodes[0], newNodes[1],2);
17983 newBound[iMarker][iElem] =
new CTriangle(newNodes[0], newNodes[1], newNodes[2],3);
17993 delete [] PeriodicBC;
17994 delete [] CreateMirror;
17999 su2double cos_max, scalar_prod, norm_vect, norm_Normal, cos_alpha, diff_coord, *Normal;
18000 unsigned long Point_Normal, jPoint;
18001 unsigned short iNeigh, iMarker, iDim;
18002 unsigned long iPoint, iVertex;
18004 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
18010 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
18016 Point_Normal = 0; cos_max = -1.0;
18017 for (iNeigh = 0; iNeigh <
node[iPoint]->
GetnPoint(); iNeigh++) {
18019 scalar_prod = 0.0; norm_vect = 0.0; norm_Normal = 0.0;
18020 for (iDim = 0; iDim <
nDim; iDim++) {
18022 scalar_prod += diff_coord*Normal[iDim];
18023 norm_vect += diff_coord*diff_coord;
18024 norm_Normal += Normal[iDim]*Normal[iDim];
18026 norm_vect = sqrt(norm_vect);
18027 norm_Normal = sqrt(norm_Normal);
18028 cos_alpha = scalar_prod/(norm_vect*norm_Normal);
18031 if (cos_alpha >= cos_max) {
18032 Point_Normal = jPoint;
18033 cos_max = cos_alpha;
18045 unsigned short iMarker = 0;
18046 su2double auxXCoord, auxYCoord, auxZCoord, *Face_Normal = NULL, auxArea, *Xcoord = NULL, *Ycoord = NULL, *Zcoord = NULL, *FaceArea = NULL;
18047 unsigned long jVertex, iVertex, ixCoord, iPoint, iVertex_Wall, nVertex_Wall = 0;
18051 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
18056 nVertex_Wall +=
nVertex[iMarker];
18064 FaceArea =
new su2double[nVertex_Wall];
18068 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
18073 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
18079 FaceArea[iVertex_Wall] = fabs(Face_Normal[
nDim-1]);
18085 vector<su2double>::iterator IterXCoordList;
18087 for (iVertex = 0; iVertex < nVertex_Wall; iVertex++)
18103 unsigned long iCoord;
18106 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
18107 if (
node[iPoint]->GetDomain()) {
18109 for (ixCoord = 0; ixCoord <
XCoordList.size()-1 && loop_on; ixCoord++) {
18111 if (dist_ratio >= 0 && dist_ratio <= 1.0) {
18112 if (dist_ratio <= 0.5) iCoord = ixCoord;
18113 else iCoord = ixCoord+1;
18125 unsigned long auxPoint;
18127 for (ixCoord = 0; ixCoord <
XCoordList.size(); ixCoord++)
18128 for (iVertex = 0; iVertex <
Xcoord_plane[ixCoord].size(); iVertex++)
18129 for (jVertex = 0; jVertex <
Xcoord_plane[ixCoord].size() - 1 - iVertex; jVertex++)
18141 delete[] Xcoord;
delete[] Ycoord;
18142 if (Zcoord != NULL)
delete[] Zcoord;
18147 unsigned short iMarker, icommas;
18148 unsigned long iVertex, iPoint, (*Point2Vertex)[2], nPointLocal = 0, nPointGlobal = 0;
18150 bool *PointInDomain;
18156 nPointGlobal = nPointLocal;
18159 Point2Vertex =
new unsigned long[nPointGlobal][2];
18160 PointInDomain =
new bool[nPointGlobal];
18162 for (iPoint = 0; iPoint < nPointGlobal; iPoint ++)
18163 PointInDomain[iPoint] =
false;
18165 for (iMarker = 0; iMarker <
nMarker; iMarker++)
18167 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
18173 Point2Vertex[iPoint][0] = iMarker;
18174 Point2Vertex[iPoint][1] = iVertex;
18175 PointInDomain[iPoint] =
true;
18182 unsigned long iExtIter, nExtIter;
18203 for (iExtIter = 0; iExtIter < nExtIter; iExtIter++) {
18208 ifstream Surface_file;
18212 strcpy (cstr, surfadj_filename.c_str());
18229 strcat (cstr, buffer);
18233 string::size_type position;
18235 Surface_file.open(cstr, ios::in);
18239 getline(Surface_file, text_line);
18240 text_line.erase (0,9);
18241 su2double AoASens = atof(text_line.c_str());
18246 getline(Surface_file, text_line);
18248 while (getline(Surface_file, text_line)) {
18249 for (icommas = 0; icommas < 50; icommas++) {
18250 position = text_line.find(
",", 0 );
18251 if (position!=string::npos) text_line.erase (position,1);
18253 stringstream point_line(text_line);
18254 point_line >> iPoint >> Sensitivity;
18256 if (PointInDomain[iPoint]) {
18260 iMarker = Point2Vertex[iPoint][0];
18261 iVertex = Point2Vertex[iPoint][1];
18271 Surface_file.close();
18274 delete[] Point2Vertex;
18275 delete[] PointInDomain;
18280 unsigned short iMarker, icommas;
18281 unsigned long iVertex, iPoint, iPoint_Local, (*Point2Vertex)[2], nPointLocal = 0, nPointGlobal = 0;
18283 bool *PointInDomain;
18296 nPointGlobal = nPointLocal;
18299 Point2Vertex =
new unsigned long[nPointGlobal][2];
18300 PointInDomain =
new bool[nPointGlobal];
18302 for (iPoint = 0; iPoint < nPointGlobal; iPoint ++)
18303 PointInDomain[iPoint] =
false;
18305 for (iMarker = 0; iMarker <
nMarker; iMarker++){
18307 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
18313 Point2Vertex[iPoint][0] = iMarker;
18314 Point2Vertex[iPoint][1] = iVertex;
18315 PointInDomain[iPoint] =
true;
18324 unsigned long iExtIter, nExtIter;
18345 for (iExtIter = 0; iExtIter < nExtIter; iExtIter++) {
18350 ifstream Surface_file;
18354 strcpy (cstr, surfadj_filename.c_str());
18371 strcat (cstr, buffer);
18375 string::size_type position;
18377 Surface_file.open(cstr, ios::in);
18381 getline(Surface_file, text_line);
18382 text_line.erase (0,9);
18383 su2double AoASens = atof(text_line.c_str());
18388 getline(Surface_file, text_line);
18390 while (getline(Surface_file, text_line)) {
18391 for (icommas = 0; icommas < 50; icommas++) {
18392 position = text_line.find(
",", 0 );
18393 if (position!=string::npos) text_line.erase (position,1);
18395 stringstream point_line(text_line);
18396 point_line >> iPoint >> dummy;
18399 for(
unsigned short iVar = 0; iVar <
nDim+2; iVar++){
18400 point_line >> dummy;
18402 for(
unsigned short iVar = 0; iVar < 2*
nDim; iVar++){
18403 point_line >> dummy;
18406 if (PointInDomain[iPoint]) {
18410 iMarker = Point2Vertex[iPoint][0];
18411 iVertex = Point2Vertex[iPoint][1];
18417 point_line >> Sensitivity_Transp;
18424 Surface_file.close();
18427 delete[] Point2Vertex;
18428 delete[] PointInDomain;
18434 ifstream restart_file;
18443 unsigned short nExtIter, iDim;
18444 unsigned long iPoint, index;
18445 string::size_type position;
18457 cout <<
"Reading in sensitivity at iteration " << nExtIter-1 <<
"."<< endl;
18459 unsigned short skipVar =
nDim, skipMult = 1;
18461 if (incompressible) { skipVar += skipMult*(
nDim+2); }
18462 if (compressible) { skipVar += skipMult*(
nDim+2); }
18463 if (sst && !frozen_visc) { skipVar += skipMult*2;}
18464 if (sa && !frozen_visc) { skipVar += skipMult*1;}
18465 if (grid_movement) { skipVar +=
nDim;}
18468 long iPoint_Local;
unsigned long iPoint_Global = 0;
string text_line;
18471 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
18472 for (iDim = 0; iDim <
nDim; iDim++) {
18473 Sensitivity[iPoint*
nDim+iDim] = 0.0;
18494 unsigned short iVar;
18495 strcpy(fname, filename.c_str());
18496 int nRestart_Vars = 5, nFields;
18497 int *Restart_Vars =
new int[5];
18499 int Restart_Iter = 0;
18500 passivedouble Restart_Meta_Passive[8] = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
18501 su2double Restart_Meta[8] = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
18508 fhw = fopen(fname,
"rb");
18519 ret = fread(Restart_Vars,
sizeof(
int), nRestart_Vars, fhw);
18520 if (ret != (
unsigned long)nRestart_Vars) {
18527 if (Restart_Vars[0] != 535532) {
18528 SU2_MPI::Error(
string(
"File ") +
string(fname) +
string(
" is not a binary SU2 restart file.\n") +
18529 string(
"SU2 reads/writes binary restart files by default.\n") +
18530 string(
"Note that backward compatibility for ASCII restart files is\n") +
18531 string(
"possible with the WRT_BINARY_RESTART / READ_BINARY_RESTART options."),
CURRENT_FUNCTION);
18536 nFields = Restart_Vars[1];
18543 config->
fields.push_back(
"Point_ID");
18544 for (iVar = 0; iVar < nFields; iVar++) {
18549 config->
fields.push_back(str_buf);
18565 fseek(fhw,-(
sizeof(
int) + 8*
sizeof(
passivedouble)), SEEK_END);
18569 ret = fread(&Restart_Iter,
sizeof(
int), 1, fhw);
18576 ret = fread(Restart_Meta_Passive,
sizeof(
passivedouble), 8, fhw);
18591 MPI_Datatype etype, filetype;
18593 unsigned long iPoint_Global, iChar;
18600 ierr = MPI_File_open(
MPI_COMM_WORLD, fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw);
18622 if (Restart_Vars[0] != 535532) {
18624 SU2_MPI::Error(
string(
"File ") +
string(fname) +
string(
" is not a binary SU2 restart file.\n") +
18625 string(
"SU2 reads/writes binary restart files by default.\n") +
18626 string(
"Note that backward compatibility for ASCII restart files is\n") +
18627 string(
"possible with the WRT_BINARY_RESTART / READ_BINARY_RESTART options."),
CURRENT_FUNCTION);
18632 nFields = Restart_Vars[1];
18640 disp = nRestart_Vars*
sizeof(int);
18653 config->
fields.push_back(
"Point_ID");
18654 for (iVar = 0; iVar < nFields; iVar++) {
18656 field_buf.append(
"\"");
18658 str_buf[iChar] = mpi_str_buf[index + iChar];
18660 field_buf.append(str_buf);
18661 field_buf.append(
"\"");
18662 config->
fields.push_back(field_buf.c_str());
18668 delete [] mpi_str_buf;
18689 blocklen[counter] = nFields;
18690 displace[counter] = iPoint_Global*nFields;
18695 MPI_Type_commit(&filetype);
18700 MPI_File_set_view(fhw, disp, etype, filetype, (
char*)
"native", MPI_INFO_NULL);
18712 MPI_Type_free(&filetype);
18716 MPI_File_set_view(fhw, 0, MPI_BYTE, MPI_BYTE, (
char*)
"native", MPI_INFO_NULL);
18723 disp = (nRestart_Vars*
sizeof(int) + nFields*
CGNS_STRING_SIZE*
sizeof(
char) +
18729 disp = (nRestart_Vars*
sizeof(int) + nFields*
CGNS_STRING_SIZE*
sizeof(
char) +
18730 nFields*Restart_Vars[2]*
sizeof(
passivedouble) + 1*
sizeof(
int));
18742 for (
unsigned short iVar = 0; iVar < 8; iVar++)
18743 Restart_Meta[iVar] = Restart_Meta_Passive[iVar];
18749 MPI_File_close(&fhw);
18751 delete [] blocklen;
18752 delete [] displace;
18766 if (iPoint_Local > -1) {
18771 index = counter*nFields + skipVar;
18772 for (iDim = 0; iDim <
nDim; iDim++) Sensitivity[iPoint_Local*
nDim+iDim] = Restart_Data[index+iDim];
18788 strcpy(fname, filename.c_str());
18796 fhw = fopen(fname,
"rb");
18807 ret = fread(&magic_number,
sizeof(
int), 1, fhw);
18815 if (magic_number == 535532) {
18816 SU2_MPI::Error(
string(
"File ") +
string(fname) +
string(
" is a binary SU2 restart file, expected ASCII.\n") +
18817 string(
"SU2 reads/writes binary restart files by default.\n") +
18818 string(
"Note that backward compatibility for ASCII restart files is\n") +
18819 string(
"possible with the WRT_BINARY_RESTART / READ_BINARY_RESTART options."),
CURRENT_FUNCTION);
18833 ierr = MPI_File_open(
MPI_COMM_WORLD, fname, MPI_MODE_RDONLY, MPI_INFO_NULL, &fhw);
18853 if (magic_number == 535532) {
18855 SU2_MPI::Error(
string(
"File ") +
string(fname) +
string(
" is a binary SU2 restart file, expected ASCII.\n") +
18856 string(
"SU2 reads/writes binary restart files by default.\n") +
18857 string(
"Note that backward compatibility for ASCII restart files is\n") +
18858 string(
"possible with the WRT_BINARY_RESTART / READ_BINARY_RESTART options."),
CURRENT_FUNCTION);
18861 MPI_File_close(&fhw);
18865 restart_file.open(filename.data(), ios::in);
18866 if (restart_file.fail()) {
18872 getline (restart_file, text_line);
18876 getline (restart_file, text_line);
18878 istringstream point_line(text_line);
18885 if (iPoint_Local > -1) {
18887 point_line >> index;
18888 for (iDim = 0; iDim < skipVar; iDim++) { point_line >> dull_val;}
18889 for (iDim = 0; iDim <
nDim; iDim++) {
18890 point_line >> Sens;
18891 Sensitivity[iPoint_Local*
nDim+iDim] = Sens;
18899 while (getline (restart_file, text_line)) {
18900 position = text_line.find (
"SENS_AOA=",0);
18901 if (position != string::npos) {
18902 text_line.erase (0,9); AoASens = atof(text_line.c_str());
18907 restart_file.close();
18915 bool isPeriodic =
false;
18916 unsigned long iVertex;
18917 unsigned short iMarker, RotationKind, nPeriodicR = 0, nPeriodicS = 0;
18921 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
18923 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
18925 if (RotationKind > 0) nPeriodicS++;
18930 nPeriodicR = nPeriodicS;
18934 if (nPeriodicR != 0) isPeriodic =
true;
18938 cout <<
"WARNING: Periodicity has been detected. Disabling multigrid. "<< endl;
18946 unsigned long iVertex, jVertex, n, Trailing_Point, Leading_Point;
18947 su2double Normal[3], Tangent[3], BiNormal[3], auxXCoord, auxYCoord, auxZCoord, zp1, zpn, MaxThickness_Value = 0, Thickness, Length, Xcoord_Trailing, Ycoord_Trailing, Zcoord_Trailing, ValCos, ValSin, XValue, ZValue, MaxDistance, Distance, AoA;
18948 vector<su2double> Xcoord, Ycoord, Zcoord, Z2coord, Xcoord_Normal, Ycoord_Normal, Zcoord_Normal, Xcoord_Airfoil_, Ycoord_Airfoil_, Zcoord_Airfoil_;
18952 MaxDistance = 0.0; Trailing_Point = 0; Leading_Point = 0;
18953 for (iVertex = 1; iVertex < Xcoord_Airfoil.size(); iVertex++) {
18954 Distance = sqrt(pow(Xcoord_Airfoil[iVertex] - Xcoord_Airfoil[Trailing_Point], 2.0) +
18955 pow(Ycoord_Airfoil[iVertex] - Ycoord_Airfoil[Trailing_Point], 2.0) +
18956 pow(Zcoord_Airfoil[iVertex] - Zcoord_Airfoil[Trailing_Point], 2.0));
18958 if (MaxDistance < Distance) { MaxDistance = Distance; Leading_Point = iVertex; }
18961 AoA = atan((Zcoord_Airfoil[Leading_Point] - Zcoord_Airfoil[Trailing_Point]) / (Xcoord_Airfoil[Trailing_Point] - Xcoord_Airfoil[Leading_Point]))*180/
PI_NUMBER;
18965 Xcoord_Trailing = Xcoord_Airfoil[0];
18966 Ycoord_Trailing = Ycoord_Airfoil[0];
18967 Zcoord_Trailing = Zcoord_Airfoil[0];
18969 for (iVertex = 0; iVertex < Xcoord_Airfoil.size(); iVertex++) {
18970 Xcoord_Airfoil_.push_back(Xcoord_Airfoil[iVertex] - Xcoord_Trailing);
18971 Ycoord_Airfoil_.push_back(Ycoord_Airfoil[iVertex] - Ycoord_Trailing);
18972 Zcoord_Airfoil_.push_back(Zcoord_Airfoil[iVertex] - Zcoord_Trailing);
18980 for (iVertex = 0; iVertex < Xcoord_Airfoil.size(); iVertex++) {
18981 XValue = Xcoord_Airfoil_[iVertex];
18982 ZValue = Zcoord_Airfoil_[iVertex];
18983 Xcoord_Airfoil_[iVertex] = XValue*ValCos - ZValue*ValSin;
18984 Zcoord_Airfoil_[iVertex] = ZValue*ValCos + XValue*ValSin;
18989 for (iVertex = 1; iVertex < Xcoord_Airfoil_.size(); iVertex++) {
18990 Tangent[0] = Xcoord_Airfoil_[iVertex] - Xcoord_Airfoil_[iVertex-1];
18991 Tangent[1] = Ycoord_Airfoil_[iVertex] - Ycoord_Airfoil_[iVertex-1];
18992 Tangent[2] = Zcoord_Airfoil_[iVertex] - Zcoord_Airfoil_[iVertex-1];
18993 Length = sqrt(pow(Tangent[0], 2.0) + pow(Tangent[1], 2.0) + pow(Tangent[2], 2.0));
18995 Tangent[0] /= Length; Tangent[1] /= Length; Tangent[2] /= Length;
18997 BiNormal[0] = Plane_Normal[0];
18998 BiNormal[1] = Plane_Normal[1];
18999 BiNormal[2] = Plane_Normal[2];
19000 Length = sqrt(pow(BiNormal[0], 2.0) + pow(BiNormal[1], 2.0) + pow(BiNormal[2], 2.0));
19001 BiNormal[0] /= Length; BiNormal[1] /= Length; BiNormal[2] /= Length;
19003 Normal[0] = Tangent[1]*BiNormal[2] - Tangent[2]*BiNormal[1];
19004 Normal[1] = Tangent[2]*BiNormal[0] - Tangent[0]*BiNormal[2];
19005 Normal[2] = Tangent[0]*BiNormal[1] - Tangent[1]*BiNormal[0];
19007 Xcoord_Normal.push_back(Normal[0]); Ycoord_Normal.push_back(Normal[1]); Zcoord_Normal.push_back(Normal[2]);
19009 unsigned short index = 2;
19014 if ((Normal[index] >= 0.0) && (fabs(Xcoord_Airfoil_[iVertex]) > MaxDistance*0.01)) {
19015 Xcoord.push_back(Xcoord_Airfoil_[iVertex]);
19016 Ycoord.push_back(Ycoord_Airfoil_[iVertex]);
19017 Zcoord.push_back(Zcoord_Airfoil_[iVertex]);
19024 for (iVertex = 0; iVertex < Xcoord.size(); iVertex++) {
19025 for (jVertex = 0; jVertex < Xcoord.size() - 1 - iVertex; jVertex++) {
19026 if (Xcoord[jVertex] > Xcoord[jVertex+1]) {
19027 auxXCoord = Xcoord[jVertex]; Xcoord[jVertex] = Xcoord[jVertex+1]; Xcoord[jVertex+1] = auxXCoord;
19028 auxYCoord = Ycoord[jVertex]; Ycoord[jVertex] = Ycoord[jVertex+1]; Ycoord[jVertex+1] = auxYCoord;
19029 auxZCoord = Zcoord[jVertex]; Zcoord[jVertex] = Zcoord[jVertex+1]; Zcoord[jVertex+1] = auxZCoord;
19036 zp1 = (Zcoord[1]-Zcoord[0])/(Xcoord[1]-Xcoord[0]);
19037 zpn = (Zcoord[n-1]-Zcoord[n-2])/(Xcoord[n-1]-Xcoord[n-2]);
19038 Z2coord.resize(n+1);
19039 SetSpline(Xcoord, Zcoord, n, zp1, zpn, Z2coord);
19044 MaxThickness_Value = 0.0;
19045 for (iVertex = 0; iVertex < Xcoord_Airfoil_.size(); iVertex++) {
19046 if (Zcoord_Normal[iVertex] < 0.0) {
19047 Thickness = fabs(Zcoord_Airfoil_[iVertex] -
GetSpline(Xcoord, Zcoord, Z2coord, n, Xcoord_Airfoil_[iVertex]));
19048 if (Thickness > MaxThickness_Value) { MaxThickness_Value = Thickness; }
19052 else { MaxThickness_Value = 0.0; }
19054 return MaxThickness_Value;
19062 su2double Dihedral_Trailing = atan((TrailingEdge_i[2] - TrailingEdge_im1[2]) / (TrailingEdge_i[1] - TrailingEdge_im1[1]))*180/
PI_NUMBER;
19066 return Dihedral_Trailing;
19074 su2double A[2],
B[2],
C[2],
BC[2], AB[2], AC[2], BC_MOD, AB_MOD, AC_MOD, AB_CROSS_AC;
19090 A[0] = TrailingEdge_im1[1];
A[1] = TrailingEdge_im1[2];
19091 B[0] = TrailingEdge_i[1];
B[1] = TrailingEdge_i[2];
19092 C[0] = TrailingEdge_ip1[1];
C[1] = TrailingEdge_ip1[2];
19094 BC[0] =
C[0] -
B[0];
BC[1] =
C[1] -
B[1];
19095 AB[0] =
B[0] -
A[0]; AB[1] =
B[1] -
A[1];
19096 AC[0] =
C[0] -
A[0]; AC[1] =
C[1] -
A[1];
19097 BC_MOD = sqrt(
BC[0]*
BC[0] +
BC[1]*
BC[1] );
19098 AB_MOD = sqrt(AB[0]*AB[0] + AB[1]*AB[1] );
19099 AC_MOD = sqrt(AC[0]*AC[0] + AC[1]*AC[1] );
19100 AB_CROSS_AC = AB[0]* AC[1] - AB[1]* AC[0];
19102 su2double Curvature_Trailing = fabs(1.0/(0.5*BC_MOD*AB_MOD*AC_MOD/AB_CROSS_AC));
19106 return Curvature_Trailing;
19111 unsigned long iVertex, Trailing_Point, Leading_Point;
19112 su2double MaxDistance, Distance, Twist = 0.0;
19116 MaxDistance = 0.0; Trailing_Point = 0; Leading_Point = 0;
19117 for (iVertex = 1; iVertex < Xcoord_Airfoil.size(); iVertex++) {
19118 Distance = sqrt(pow(Xcoord_Airfoil[iVertex] - Xcoord_Airfoil[Trailing_Point], 2.0) +
19119 pow(Ycoord_Airfoil[iVertex] - Ycoord_Airfoil[Trailing_Point], 2.0) +
19120 pow(Zcoord_Airfoil[iVertex] - Zcoord_Airfoil[Trailing_Point], 2.0));
19122 if (MaxDistance < Distance) { MaxDistance = Distance; Leading_Point = iVertex; }
19125 Twist = atan((Zcoord_Airfoil[Leading_Point] - Zcoord_Airfoil[Trailing_Point]) / (Xcoord_Airfoil[Trailing_Point] - Xcoord_Airfoil[Leading_Point]))*180/
PI_NUMBER;
19132 vector<su2double> &Xcoord_Airfoil, vector<su2double> &Ycoord_Airfoil, vector<su2double> &Zcoord_Airfoil) {
19134 unsigned long iVertex, Trailing_Point, Leading_Point;
19139 MaxDistance = 0.0; Trailing_Point = 0; Leading_Point = 0;
19140 for (iVertex = 1; iVertex < Xcoord_Airfoil.size(); iVertex++) {
19142 Distance = sqrt(pow(Xcoord_Airfoil[iVertex] - Xcoord_Airfoil[Trailing_Point], 2.0) +
19143 pow(Ycoord_Airfoil[iVertex] - Ycoord_Airfoil[Trailing_Point], 2.0) +
19144 pow(Zcoord_Airfoil[iVertex] - Zcoord_Airfoil[Trailing_Point], 2.0));
19146 if (MaxDistance < Distance) { MaxDistance = Distance; Leading_Point = iVertex; }
19149 LeadingEdge[0] = Xcoord_Airfoil[Leading_Point];
19150 LeadingEdge[1] = Ycoord_Airfoil[Leading_Point];
19151 LeadingEdge[2] = Zcoord_Airfoil[Leading_Point];
19153 TrailingEdge[0] = Xcoord_Airfoil[Trailing_Point];
19154 TrailingEdge[1] = Ycoord_Airfoil[Trailing_Point];
19155 TrailingEdge[2] = Zcoord_Airfoil[Trailing_Point];
19160 vector<su2double> &Xcoord_Airfoil, vector<su2double> &Ycoord_Airfoil, vector<su2double> &Zcoord_Airfoil) {
19162 unsigned long iVertex, Trailing_Point, Leading_Point;
19165 MaxDistance = 0.0; Trailing_Point = 0; Leading_Point = 0;
19166 for (iVertex = 1; iVertex < Xcoord_Airfoil.size(); iVertex++) {
19167 Distance = sqrt(pow(Xcoord_Airfoil[iVertex] - Xcoord_Airfoil[Trailing_Point], 2.0));
19168 if (MaxDistance < Distance) { MaxDistance = Distance; Leading_Point = iVertex; }
19171 LeadingEdge[0] = Xcoord_Airfoil[Leading_Point];
19172 LeadingEdge[1] = Ycoord_Airfoil[Leading_Point];
19173 LeadingEdge[2] = Zcoord_Airfoil[Leading_Point];
19175 MaxDistance = 0.0; Trailing_Point = 0; Leading_Point = 0;
19176 for (iVertex = 1; iVertex < Zcoord_Airfoil.size(); iVertex++) {
19177 Distance = sqrt(pow(Zcoord_Airfoil[iVertex] - Zcoord_Airfoil[Trailing_Point], 2.0));
19178 if (MaxDistance < Distance) { MaxDistance = Distance; Leading_Point = iVertex; }
19181 TrailingEdge[0] = 0.5*(Xcoord_Airfoil[Trailing_Point]+Xcoord_Airfoil[Leading_Point]);
19182 TrailingEdge[1] = 0.5*(Ycoord_Airfoil[Trailing_Point]+Ycoord_Airfoil[Leading_Point]);
19183 TrailingEdge[2] = 0.5*(Zcoord_Airfoil[Trailing_Point]+Zcoord_Airfoil[Leading_Point]);
19188 unsigned long iVertex, Trailing_Point;
19189 su2double MaxDistance, Distance, Chord = 0.0;
19192 MaxDistance = 0.0; Trailing_Point = 0;
19193 for (iVertex = 1; iVertex < Xcoord_Airfoil.size(); iVertex++) {
19195 Distance = sqrt(pow(Xcoord_Airfoil[iVertex] - Xcoord_Airfoil[Trailing_Point], 2.0) +
19196 pow(Ycoord_Airfoil[iVertex] - Ycoord_Airfoil[Trailing_Point], 2.0) +
19197 pow(Zcoord_Airfoil[iVertex] - Zcoord_Airfoil[Trailing_Point], 2.0));
19199 if (MaxDistance < Distance) { MaxDistance = Distance; }
19202 Chord = MaxDistance;
19210 unsigned long iVertex, Trailing_Point;
19211 su2double MaxDistance, Distance, Width = 0.0;
19213 MaxDistance = 0.0; Trailing_Point = 0;
19214 for (iVertex = 1; iVertex < Xcoord_Airfoil.size(); iVertex++) {
19215 Distance = fabs(Xcoord_Airfoil[iVertex] - Xcoord_Airfoil[Trailing_Point]);
19216 if (MaxDistance < Distance) { MaxDistance = Distance; }
19219 Width = MaxDistance;
19226 unsigned long iVertex, Trailing_Point;
19227 su2double MinDistance, Distance, WaterLineWidth = 0.0;
19230 MinDistance = 1E10; WaterLineWidth = 0; Trailing_Point = 0;
19231 for (iVertex = 0; iVertex < Xcoord_Airfoil.size(); iVertex++) {
19232 Distance = fabs(Zcoord_Airfoil[iVertex] - WaterLine);
19233 if (Distance < MinDistance) {
19234 MinDistance = Distance;
19235 WaterLineWidth = fabs(Xcoord_Airfoil[iVertex] - Xcoord_Airfoil[Trailing_Point]);
19239 return WaterLineWidth;
19245 unsigned long iVertex, Trailing_Point;
19246 su2double MaxDistance, Distance, Height = 0.0;
19248 MaxDistance = 0.0; Trailing_Point = 0;
19249 for (iVertex = 1; iVertex < Zcoord_Airfoil.size(); iVertex++) {
19250 Distance = sqrt(pow(Zcoord_Airfoil[iVertex] - Zcoord_Airfoil[Trailing_Point], 2.0));
19251 if (MaxDistance < Distance) { MaxDistance = Distance; }
19254 Height = MaxDistance;
19262 unsigned long iVertex, Trailing_Point, Leading_Point;
19263 su2double MaxDistance, Distance, LERadius = 0.0, X1, X2, X3, Y1, Y2, Y3, Ma, Mb, Xc, Yc, Radius;
19267 MaxDistance = 0.0; Trailing_Point = 0; Leading_Point = 0;
19268 for (iVertex = 1; iVertex < Xcoord_Airfoil.size(); iVertex++) {
19270 Distance = sqrt(pow(Xcoord_Airfoil[iVertex] - Xcoord_Airfoil[Trailing_Point], 2.0) +
19271 pow(Ycoord_Airfoil[iVertex] - Ycoord_Airfoil[Trailing_Point], 2.0) +
19272 pow(Zcoord_Airfoil[iVertex] - Zcoord_Airfoil[Trailing_Point], 2.0));
19274 if (MaxDistance < Distance) { MaxDistance = Distance; Leading_Point = iVertex; }
19277 X1 = Xcoord_Airfoil[Leading_Point-3];
19278 Y1 = Zcoord_Airfoil[Leading_Point-3];
19280 X2 = Xcoord_Airfoil[Leading_Point];
19281 Y2 = Zcoord_Airfoil[Leading_Point];
19283 X3 = Xcoord_Airfoil[Leading_Point+3];
19284 Y3 = Zcoord_Airfoil[Leading_Point+3];
19286 if (X2 != X1) Ma = (Y2-Y1) / (X2-X1);
else Ma = 0.0;
19287 if (X3 != X2) Mb = (Y3-Y2) / (X3-X2);
else Mb = 0.0;
19289 if (Mb != Ma) Xc = (Ma*Mb*(Y1-Y3)+Mb*(X1+X2)-Ma*(X2+X3))/(2.0*(Mb-Ma));
else Xc = 0.0;
19290 if (Ma != 0.0) Yc = -(1.0/Ma)*(Xc-0.5*(X1+X2))+0.5*(Y1+Y2);
else Yc = 0.0;
19292 Radius = sqrt((Xc-X1)*(Xc-X1)+(Yc-Y1)*(Yc-Y1));
19293 if (Radius != 0.0) LERadius = 1.0/Radius;
else LERadius = 0.0;
19301 unsigned long iVertex, jVertex, n_Upper, n_Lower, Trailing_Point, Leading_Point;
19302 su2double Thickness_Location, Normal[3], Tangent[3], BiNormal[3], auxXCoord, auxYCoord, auxZCoord, Thickness_Value = 0.0, Length, Xcoord_Trailing, Ycoord_Trailing, Zcoord_Trailing, ValCos, ValSin, XValue, ZValue, zp1, zpn, Chord, MaxDistance, Distance, AoA;
19303 vector<su2double> Xcoord_Upper, Ycoord_Upper, Zcoord_Upper, Z2coord_Upper, Xcoord_Lower, Ycoord_Lower, Zcoord_Lower, Z2coord_Lower, Z2coord, Xcoord_Normal, Ycoord_Normal, Zcoord_Normal, Xcoord_Airfoil_, Ycoord_Airfoil_, Zcoord_Airfoil_;
19304 su2double Zcoord_Up, Zcoord_Down, ZLoc_, YLoc_;
19308 MaxDistance = 0.0; Trailing_Point = 0; Leading_Point = 0;
19309 for (iVertex = 1; iVertex < Xcoord_Airfoil.size(); iVertex++) {
19310 Distance = sqrt(pow(Xcoord_Airfoil[iVertex] - Xcoord_Airfoil[Trailing_Point], 2.0) +
19311 pow(Ycoord_Airfoil[iVertex] - Ycoord_Airfoil[Trailing_Point], 2.0) +
19312 pow(Zcoord_Airfoil[iVertex] - Zcoord_Airfoil[Trailing_Point], 2.0));
19314 if (MaxDistance < Distance) { MaxDistance = Distance; Leading_Point = iVertex; }
19317 AoA = atan((Zcoord_Airfoil[Leading_Point] - Zcoord_Airfoil[Trailing_Point]) / (Xcoord_Airfoil[Trailing_Point] - Xcoord_Airfoil[Leading_Point]))*180/
PI_NUMBER;
19318 Chord = MaxDistance;
19322 Xcoord_Trailing = Xcoord_Airfoil[0];
19323 Ycoord_Trailing = Ycoord_Airfoil[0];
19324 Zcoord_Trailing = Zcoord_Airfoil[0];
19326 for (iVertex = 0; iVertex < Xcoord_Airfoil.size(); iVertex++) {
19327 Xcoord_Airfoil_.push_back(Xcoord_Airfoil[iVertex] - Xcoord_Trailing);
19328 Ycoord_Airfoil_.push_back(Ycoord_Airfoil[iVertex] - Ycoord_Trailing);
19329 Zcoord_Airfoil_.push_back(Zcoord_Airfoil[iVertex] - Zcoord_Trailing);
19337 for (iVertex = 0; iVertex < Xcoord_Airfoil.size(); iVertex++) {
19338 XValue = Xcoord_Airfoil_[iVertex];
19339 ZValue = Zcoord_Airfoil_[iVertex];
19341 Xcoord_Airfoil_[iVertex] = XValue*ValCos - ZValue*ValSin;
19342 Zcoord_Airfoil_[iVertex] = ZValue*ValCos + XValue*ValSin;
19347 for (iVertex = 1; iVertex < Xcoord_Airfoil_.size(); iVertex++) {
19348 Tangent[0] = Xcoord_Airfoil_[iVertex] - Xcoord_Airfoil_[iVertex-1];
19349 Tangent[1] = Ycoord_Airfoil_[iVertex] - Ycoord_Airfoil_[iVertex-1];
19350 Tangent[2] = Zcoord_Airfoil_[iVertex] - Zcoord_Airfoil_[iVertex-1];
19351 Length = sqrt(pow(Tangent[0], 2.0) + pow(Tangent[1], 2.0) + pow(Tangent[2], 2.0));
19352 Tangent[0] /= Length; Tangent[1] /= Length; Tangent[2] /= Length;
19354 BiNormal[0] = Plane_Normal[0];
19355 BiNormal[1] = Plane_Normal[1];
19356 BiNormal[2] = Plane_Normal[2];
19357 Length = sqrt(pow(BiNormal[0], 2.0) + pow(BiNormal[1], 2.0) + pow(BiNormal[2], 2.0));
19358 BiNormal[0] /= Length; BiNormal[1] /= Length; BiNormal[2] /= Length;
19360 Normal[0] = Tangent[1]*BiNormal[2] - Tangent[2]*BiNormal[1];
19361 Normal[1] = Tangent[2]*BiNormal[0] - Tangent[0]*BiNormal[2];
19362 Normal[2] = Tangent[0]*BiNormal[1] - Tangent[1]*BiNormal[0];
19364 Xcoord_Normal.push_back(Normal[0]); Ycoord_Normal.push_back(Normal[1]); Zcoord_Normal.push_back(Normal[2]);
19366 unsigned short index = 2;
19368 if (Normal[index] >= 0.0) {
19369 Xcoord_Upper.push_back(Xcoord_Airfoil_[iVertex]);
19370 Ycoord_Upper.push_back(Ycoord_Airfoil_[iVertex]);
19371 Zcoord_Upper.push_back(Zcoord_Airfoil_[iVertex]);
19374 Xcoord_Lower.push_back(Xcoord_Airfoil_[iVertex]);
19375 Ycoord_Lower.push_back(Ycoord_Airfoil_[iVertex]);
19376 Zcoord_Lower.push_back(Zcoord_Airfoil_[iVertex]);
19383 for (iVertex = 0; iVertex < Xcoord_Upper.size(); iVertex++) {
19384 for (jVertex = 0; jVertex < Xcoord_Upper.size() - 1 - iVertex; jVertex++) {
19385 if (Xcoord_Upper[jVertex] > Xcoord_Upper[jVertex+1]) {
19386 auxXCoord = Xcoord_Upper[jVertex]; Xcoord_Upper[jVertex] = Xcoord_Upper[jVertex+1]; Xcoord_Upper[jVertex+1] = auxXCoord;
19387 auxYCoord = Ycoord_Upper[jVertex]; Ycoord_Upper[jVertex] = Ycoord_Upper[jVertex+1]; Ycoord_Upper[jVertex+1] = auxYCoord;
19388 auxZCoord = Zcoord_Upper[jVertex]; Zcoord_Upper[jVertex] = Zcoord_Upper[jVertex+1]; Zcoord_Upper[jVertex+1] = auxZCoord;
19395 for (iVertex = 0; iVertex < Xcoord_Lower.size(); iVertex++) {
19396 for (jVertex = 0; jVertex < Xcoord_Lower.size() - 1 - iVertex; jVertex++) {
19397 if (Xcoord_Lower[jVertex] > Xcoord_Lower[jVertex+1]) {
19398 auxXCoord = Xcoord_Lower[jVertex]; Xcoord_Lower[jVertex] = Xcoord_Lower[jVertex+1]; Xcoord_Lower[jVertex+1] = auxXCoord;
19399 auxYCoord = Ycoord_Lower[jVertex]; Ycoord_Lower[jVertex] = Ycoord_Lower[jVertex+1]; Ycoord_Lower[jVertex+1] = auxYCoord;
19400 auxZCoord = Zcoord_Lower[jVertex]; Zcoord_Lower[jVertex] = Zcoord_Lower[jVertex+1]; Zcoord_Lower[jVertex+1] = auxZCoord;
19405 n_Upper = Xcoord_Upper.size();
19407 zp1 = (Zcoord_Upper[1]-Zcoord_Upper[0])/(Xcoord_Upper[1]-Xcoord_Upper[0]);
19408 zpn = (Zcoord_Upper[n_Upper-1]-Zcoord_Upper[n_Upper-2])/(Xcoord_Upper[n_Upper-1]-Xcoord_Upper[n_Upper-2]);
19409 Z2coord_Upper.resize(n_Upper+1);
19410 SetSpline(Xcoord_Upper, Zcoord_Upper, n_Upper, zp1, zpn, Z2coord_Upper);
19413 n_Lower = Xcoord_Lower.size();
19415 zp1 = (Zcoord_Lower[1]-Zcoord_Lower[0])/(Xcoord_Lower[1]-Xcoord_Lower[0]);
19416 zpn = (Zcoord_Lower[n_Lower-1]-Zcoord_Lower[n_Lower-2])/(Xcoord_Lower[n_Lower-1]-Xcoord_Lower[n_Lower-2]);
19417 Z2coord_Lower.resize(n_Lower+1);
19418 SetSpline(Xcoord_Lower, Zcoord_Lower, n_Lower, zp1, zpn, Z2coord_Lower);
19421 if ((n_Upper > 1) && (n_Lower > 1)) {
19423 Thickness_Location = - Chord*(1.0-Location);
19425 Zcoord_Up =
GetSpline(Xcoord_Upper, Zcoord_Upper, Z2coord_Upper, n_Upper, Thickness_Location);
19426 Zcoord_Down =
GetSpline(Xcoord_Lower, Zcoord_Lower, Z2coord_Lower, n_Lower, Thickness_Location);
19428 YLoc_ = Thickness_Location;
19429 ZLoc_ = 0.5*(Zcoord_Up + Zcoord_Down);
19431 ZLoc = sin(-AoA*
PI_NUMBER/180.0)*YLoc_ + cos(-AoA*
PI_NUMBER/180.0)*ZLoc_ + Zcoord_Trailing;
19436 Thickness_Value = fabs(Zcoord_Up - Zcoord_Down);
19439 else { Thickness_Value = 0.0; }
19441 return Thickness_Value;
19446 vector<su2double> &Xcoord_Airfoil, vector<su2double> &Ycoord_Airfoil, vector<su2double> &Zcoord_Airfoil) {
19447 unsigned long iVertex;
19449 vector<su2double> Xcoord_Upper, Ycoord_Upper, Zcoord_Upper, Xcoord_Lower, Ycoord_Lower, Zcoord_Lower, Z2coord, Xcoord_Normal, Ycoord_Normal, Zcoord_Normal, Xcoord_Airfoil_, Ycoord_Airfoil_, Zcoord_Airfoil_;
19457 for (iVertex = 0; iVertex < Xcoord_Airfoil.size()-1; iVertex++) {
19458 X = 0.5*(Xcoord_Airfoil[iVertex]+Xcoord_Airfoil[iVertex+1]);
19459 Z = 0.5*(Zcoord_Airfoil[iVertex]+Zcoord_Airfoil[iVertex+1]);
19460 DeltaX = Xcoord_Airfoil[iVertex+1] - Xcoord_Airfoil[iVertex];
19461 DeltaZ = Zcoord_Airfoil[iVertex+1] - Zcoord_Airfoil[iVertex];
19462 Area_Value += 0.5*( X*DeltaZ-Z*DeltaX);
19465 X = 0.5*(Xcoord_Airfoil[Xcoord_Airfoil.size()-1]+Xcoord_Airfoil[0]);
19466 Z = 0.5*(Zcoord_Airfoil[Xcoord_Airfoil.size()-1]+Zcoord_Airfoil[0]);
19467 DeltaX = Xcoord_Airfoil[0] - Xcoord_Airfoil[Xcoord_Airfoil.size()-1];
19468 DeltaZ = Zcoord_Airfoil[0] - Zcoord_Airfoil[Xcoord_Airfoil.size()-1];
19469 Area_Value += 0.5 * (X*DeltaZ-Z*DeltaX);
19471 Area_Value = fabs(Area_Value);
19478 vector<su2double> &Xcoord_Airfoil, vector<su2double> &Ycoord_Airfoil, vector<su2double> &Zcoord_Airfoil) {
19479 unsigned long iVertex;
19480 su2double Length_Value = 0.0, Length_Value_ = 0.0;
19487 Length_Value = 0.0;
19488 for (iVertex = 0; iVertex < Xcoord_Airfoil.size()-2; iVertex++) {
19489 DeltaX = Xcoord_Airfoil[iVertex+1] - Xcoord_Airfoil[iVertex];
19490 DeltaZ = Zcoord_Airfoil[iVertex+1] - Zcoord_Airfoil[iVertex];
19491 Length_Value += sqrt(DeltaX*DeltaX + DeltaZ*DeltaZ);
19494 Length_Value_ = 0.0;
19495 for (iVertex = 1; iVertex < Xcoord_Airfoil.size()-1; iVertex++) {
19496 DeltaX = Xcoord_Airfoil[iVertex+1] - Xcoord_Airfoil[iVertex];
19497 DeltaZ = Zcoord_Airfoil[iVertex+1] - Zcoord_Airfoil[iVertex];
19498 Length_Value_ += sqrt(DeltaX*DeltaX + DeltaZ*DeltaZ);
19501 Length_Value = min(Length_Value, Length_Value_);
19503 return Length_Value;
19513 unsigned short iPlane, iDim, nPlane = 0;
19514 unsigned long iVertex;
19515 su2double MinPlane, MaxPlane, dPlane, *Area, *MaxThickness, *ToC, *Chord, *LERadius, *Twist, *Curvature, *Dihedral, SemiSpan;
19516 vector<su2double> *Xcoord_Airfoil, *Ycoord_Airfoil, *Zcoord_Airfoil, *Variable_Airfoil;
19517 ofstream Wing_File, Section_File;
19536 for (iPlane = 0; iPlane < nPlane; iPlane++ )
19540 for (iPlane = 0; iPlane < nPlane; iPlane++ )
19544 for (iPlane = 0; iPlane < nPlane; iPlane++ )
19548 for (iPlane = 0; iPlane < nPlane; iPlane++ )
19552 dPlane = fabs((MaxPlane - MinPlane)/
su2double(nPlane-1));
19554 for (iPlane = 0; iPlane < nPlane; iPlane++) {
19555 Plane_Normal[iPlane][0] = 0.0; Plane_P0[iPlane][0] = 0.0;
19556 Plane_Normal[iPlane][1] = 0.0; Plane_P0[iPlane][1] = 0.0;
19557 Plane_Normal[iPlane][2] = 0.0; Plane_P0[iPlane][2] = 0.0;
19560 Plane_Normal[iPlane][1] = 1.0;
19561 Plane_P0[iPlane][1] = MinPlane + iPlane*dPlane;
19565 Plane_Normal[iPlane][2] = 1.0;
19566 Plane_P0[iPlane][2] = MinPlane + iPlane*dPlane;
19573 Xcoord_Airfoil =
new vector<su2double>[nPlane];
19574 Ycoord_Airfoil =
new vector<su2double>[nPlane];
19575 Zcoord_Airfoil =
new vector<su2double>[nPlane];
19576 Variable_Airfoil =
new vector<su2double>[nPlane];
19580 for (iPlane = 0; iPlane < nPlane; iPlane++) {
19583 -1E6, 1E6, -1E6, 1E6, -1E6, 1E6, NULL, Xcoord_Airfoil[iPlane],
19584 Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane],
19585 Variable_Airfoil[iPlane], original_surface, config);
19596 Wing_File.open(
"wing_description.csv", ios::out);
19598 Wing_File <<
"\"yCoord/SemiSpan\",\"Area (in^2)\",\"Max. Thickness (in)\",\"Chord (in)\",\"Leading Edge Radius (1/in)\",\"Max. Thickness/Chord\",\"Twist (deg)\",\"Curvature (1/in)\",\"Dihedral (deg)\",\"Leading Edge XLoc/SemiSpan\",\"Leading Edge ZLoc/SemiSpan\",\"Trailing Edge XLoc/SemiSpan\",\"Trailing Edge ZLoc/SemiSpan\"" << endl;
19600 Wing_File <<
"\"yCoord/SemiSpan\",\"Area (m^2)\",\"Max. Thickness (m)\",\"Chord (m)\",\"Leading Edge Radius (1/m)\",\"Max. Thickness/Chord\",\"Twist (deg)\",\"Curvature (1/in)\",\"Dihedral (deg)\",\"Leading Edge XLoc/SemiSpan\",\"Leading Edge ZLoc/SemiSpan\",\"Trailing Edge XLoc/SemiSpan\",\"Trailing Edge ZLoc/SemiSpan\"" << endl;
19603 Wing_File.open(
"wing_description.dat", ios::out);
19604 Wing_File <<
"TITLE = \"Wing description\"" << endl;
19606 Wing_File <<
"VARIABLES = \"<greek>h</greek>\",\"Area (in<sup>2</sup>)\",\"Max. Thickness (in)\",\"Chord (in)\",\"Leading Edge Radius (1/in)\",\"Max. Thickness/Chord\",\"Twist (deg)\",\"Curvature (1/in)\",\"Dihedral (deg)\",\"Leading Edge XLoc/SemiSpan\",\"Leading Edge ZLoc/SemiSpan\",\"Trailing Edge XLoc/SemiSpan\",\"Trailing Edge ZLoc/SemiSpan\"" << endl;
19608 Wing_File <<
"VARIABLES = \"<greek>h</greek>\",\"Area (m<sup>2</sup>)\",\"Max. Thickness (m)\",\"Chord (m)\",\"Leading Edge Radius (1/m)\",\"Max. Thickness/Chord\",\"Twist (deg)\",\"Curvature (1/m)\",\"Dihedral (deg)\",\"Leading Edge XLoc/SemiSpan\",\"Leading Edge ZLoc/SemiSpan\",\"Trailing Edge XLoc/SemiSpan\",\"Trailing Edge ZLoc/SemiSpan\"" << endl;
19609 Wing_File <<
"ZONE T= \"Baseline wing\"" << endl;
19615 for (iPlane = 0; iPlane < nPlane; iPlane++) {
19617 for (iDim = 0; iDim <
nDim; iDim++) {
19618 LeadingEdge[iPlane][iDim] = 0.0;
19619 TrailingEdge[iPlane][iDim] = 0.0;
19622 Area[iPlane] = 0.0;
19623 MaxThickness[iPlane] = 0.0;
19624 Chord[iPlane] = 0.0;
19625 LERadius[iPlane] = 0.0;
19627 Twist[iPlane] = 0.0;
19629 if (Xcoord_Airfoil[iPlane].
size() > 1) {
19631 Compute_Wing_LeadingTrailing(LeadingEdge[iPlane], TrailingEdge[iPlane], Plane_P0[iPlane], Plane_Normal[iPlane], Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
19633 Area[iPlane] =
Compute_Area(Plane_P0[iPlane], Plane_Normal[iPlane], config, Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
19635 MaxThickness[iPlane] =
Compute_MaxThickness(Plane_P0[iPlane], Plane_Normal[iPlane], config, Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
19637 Chord[iPlane] =
Compute_Chord(Plane_P0[iPlane], Plane_Normal[iPlane], Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
19639 Twist[iPlane] =
Compute_Twist(Plane_P0[iPlane], Plane_Normal[iPlane], Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
19641 LERadius[iPlane] =
Compute_LERadius(Plane_P0[iPlane], Plane_Normal[iPlane], Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
19643 ToC[iPlane] = MaxThickness[iPlane] / Chord[iPlane];
19652 for (iPlane = 0; iPlane < nPlane; iPlane++) {
19654 Curvature[iPlane] = 0.0;
19655 Dihedral[iPlane] = 0.0;
19657 if (Xcoord_Airfoil[iPlane].
size() > 1) {
19659 if ((iPlane == 0) || (iPlane == nPlane-1)) Curvature[iPlane] = 0.0;
19660 else Curvature[iPlane] =
Compute_Curvature(LeadingEdge[iPlane-1], TrailingEdge[iPlane-1],
19661 LeadingEdge[iPlane], TrailingEdge[iPlane],
19662 LeadingEdge[iPlane+1], TrailingEdge[iPlane+1]);
19664 if (iPlane == 0) Dihedral[iPlane] = 0.0;
19665 else Dihedral[iPlane] =
Compute_Dihedral(LeadingEdge[iPlane-1], TrailingEdge[iPlane-1],
19666 LeadingEdge[iPlane], TrailingEdge[iPlane]);
19675 if ((Xcoord_Airfoil[0].
size() != 0) && (Xcoord_Airfoil[1].
size() != 0)) {
19676 Curvature[0] = Curvature[1]; Dihedral[0] = Dihedral[1];
19678 if ((Xcoord_Airfoil[nPlane-1].
size() != 0) && (Xcoord_Airfoil[nPlane-2].
size() != 0)) {
19679 Curvature[nPlane-1] = Curvature[nPlane-2];
19685 for (iPlane = 0; iPlane < nPlane; iPlane++) {
19686 if (Xcoord_Airfoil[iPlane].
size() > 1) {
19688 Wing_File << Ycoord_Airfoil[iPlane][0]/SemiSpan <<
", "<< Area[iPlane] <<
", "<< MaxThickness[iPlane] <<
", "<< Chord[iPlane] <<
", "<< LERadius[iPlane] <<
", "<< ToC[iPlane]
19689 <<
", "<< Twist[iPlane] <<
", "<< Curvature[iPlane] <<
", "<< Dihedral[iPlane]
19690 <<
", "<< LeadingEdge[iPlane][0]/SemiSpan <<
", "<< LeadingEdge[iPlane][2]/SemiSpan
19691 <<
", "<< TrailingEdge[iPlane][0]/SemiSpan <<
", "<< TrailingEdge[iPlane][2]/SemiSpan << endl;
19694 Wing_File << Ycoord_Airfoil[iPlane][0]/SemiSpan <<
" "<< Area[iPlane] <<
" "<< MaxThickness[iPlane] <<
" "<< Chord[iPlane] <<
" "<< LERadius[iPlane] <<
" "<< ToC[iPlane]
19695 <<
" "<< Twist[iPlane] <<
" "<< Curvature[iPlane] <<
" "<< Dihedral[iPlane]
19696 <<
" "<< LeadingEdge[iPlane][0]/SemiSpan <<
" "<< LeadingEdge[iPlane][2]/SemiSpan
19697 <<
" "<< TrailingEdge[iPlane][0]/SemiSpan <<
" "<< TrailingEdge[iPlane][2]/SemiSpan << endl;
19705 Section_File.open(
"wing_slices.dat", ios::out);
19707 for (iPlane = 0; iPlane < nPlane; iPlane++) {
19710 Section_File <<
"TITLE = \"Aircraft Slices\"" << endl;
19712 Section_File <<
"VARIABLES = \"x (in)\", \"y (in)\", \"z (in)\", \"x<sub>2D</sub>/c\", \"y<sub>2D</sub>/c\"" << endl;
19713 else Section_File <<
"VARIABLES = \"x (m)\", \"y (m)\", \"z (m)\", \"x<sub>2D</sub>/c\", \"y<sub>2D</sub>/c\"" << endl;
19716 if (Xcoord_Airfoil[iPlane].
size() > 1) {
19718 Section_File <<
"ZONE T=\"<greek>h</greek> = " << Ycoord_Airfoil[iPlane][0]/SemiSpan <<
" \", I= " << Xcoord_Airfoil[iPlane].size() <<
", F=POINT" << endl;
19720 for (iVertex = 0; iVertex < Xcoord_Airfoil[iPlane].size(); iVertex++) {
19724 su2double XValue_ = Xcoord_Airfoil[iPlane][iVertex] - LeadingEdge[iPlane][0];
19725 su2double ZValue_ = Zcoord_Airfoil[iPlane][iVertex] - LeadingEdge[iPlane][2];
19732 su2double XValue = (XValue_*ValCos - ZValue_*ValSin) / Chord[iPlane];
19733 su2double ZValue = (ZValue_*ValCos + XValue_*ValSin) / Chord[iPlane];
19737 Section_File << Xcoord_Airfoil[iPlane][iVertex] <<
" " << Ycoord_Airfoil[iPlane][iVertex] <<
" " << Zcoord_Airfoil[iPlane][iVertex] <<
" " << XValue <<
" " << ZValue << endl;
19743 Section_File.close();
19749 for (iPlane = 0; iPlane < nPlane-2; iPlane+=2) {
19750 if (Xcoord_Airfoil[iPlane].
size() > 1) {
19751 Wing_Volume += (1.0/3.0)*dPlane*(Area[iPlane] + 4.0*Area[iPlane+1] + Area[iPlane+2]);
19757 Wing_MaxMaxThickness = -1E6; Wing_MinMaxThickness = 1E6; Wing_MinChord = 1E6; Wing_MaxChord = -1E6;
19758 Wing_MinLERadius = 1E6; Wing_MaxLERadius = -1E6; Wing_MinToC = 1E6; Wing_MaxToC = -1E6;
19759 Wing_MaxTwist = -1E6; Wing_MaxCurvature = -1E6; Wing_MaxDihedral = -1E6;
19761 for (iPlane = 0; iPlane < nPlane; iPlane++) {
19762 if (MaxThickness[iPlane] != 0.0) Wing_MinMaxThickness = min(Wing_MinMaxThickness, MaxThickness[iPlane]);
19763 Wing_MaxMaxThickness = max(Wing_MaxMaxThickness, MaxThickness[iPlane]);
19764 if (Chord[iPlane] != 0.0) Wing_MinChord = min(Wing_MinChord, Chord[iPlane]);
19765 Wing_MaxChord = max(Wing_MaxChord, Chord[iPlane]);
19766 if (LERadius[iPlane] != 0.0) Wing_MinLERadius = min(Wing_MinLERadius, LERadius[iPlane]);
19767 Wing_MaxLERadius = max(Wing_MaxLERadius, LERadius[iPlane]);
19768 if (ToC[iPlane] != 0.0) Wing_MinToC = min(Wing_MinToC, ToC[iPlane]);
19769 Wing_MaxToC = max(Wing_MaxToC, ToC[iPlane]);
19770 Wing_ObjFun_MinToC = sqrt((Wing_MinToC - 0.07)*(Wing_MinToC - 0.07));
19771 Wing_MaxTwist = max(Wing_MaxTwist, fabs(Twist[iPlane]));
19772 Wing_MaxCurvature = max(Wing_MaxCurvature, Curvature[iPlane]);
19773 Wing_MaxDihedral = max(Wing_MaxDihedral, fabs(Dihedral[iPlane]));
19780 delete [] Xcoord_Airfoil;
19781 delete [] Ycoord_Airfoil;
19782 delete [] Zcoord_Airfoil;
19783 delete [] Variable_Airfoil;
19785 for (iPlane = 0; iPlane < nPlane; iPlane++)
19786 delete [] LeadingEdge[iPlane];
19787 delete [] LeadingEdge;
19789 for (iPlane = 0; iPlane < nPlane; iPlane++)
19790 delete [] TrailingEdge[iPlane];
19791 delete [] TrailingEdge;
19793 for (iPlane = 0; iPlane < nPlane; iPlane++)
19794 delete [] Plane_P0[iPlane];
19795 delete [] Plane_P0;
19797 for (iPlane = 0; iPlane < nPlane; iPlane++)
19798 delete [] Plane_Normal[iPlane];
19799 delete [] Plane_Normal;
19802 delete [] MaxThickness;
19804 delete [] LERadius;
19807 delete [] Curvature;
19808 delete [] Dihedral;
19819 unsigned short iPlane, iDim, nPlane = 0;
19820 unsigned long iVertex;
19821 su2double MinPlane, MaxPlane, dPlane, *Area, *Length, *Width, *WaterLineWidth, *Height, *Curvature;
19822 vector<su2double> *Xcoord_Airfoil, *Ycoord_Airfoil, *Zcoord_Airfoil, *Variable_Airfoil;
19823 ofstream Fuselage_File, Section_File;
19834 WaterLineWidth =
new su2double [nPlane];
19839 for (iPlane = 0; iPlane < nPlane; iPlane++ )
19843 for (iPlane = 0; iPlane < nPlane; iPlane++ )
19847 for (iPlane = 0; iPlane < nPlane; iPlane++ )
19851 for (iPlane = 0; iPlane < nPlane; iPlane++ )
19855 dPlane = fabs((MaxPlane - MinPlane)/
su2double(nPlane-1));
19857 for (iPlane = 0; iPlane < nPlane; iPlane++) {
19858 Plane_Normal[iPlane][0] = 0.0; Plane_P0[iPlane][0] = 0.0;
19859 Plane_Normal[iPlane][1] = 0.0; Plane_P0[iPlane][1] = 0.0;
19860 Plane_Normal[iPlane][2] = 0.0; Plane_P0[iPlane][2] = 0.0;
19862 Plane_Normal[iPlane][0] = 1.0;
19863 Plane_P0[iPlane][0] = MinPlane + iPlane*dPlane;
19869 Xcoord_Airfoil =
new vector<su2double>[nPlane];
19870 Ycoord_Airfoil =
new vector<su2double>[nPlane];
19871 Zcoord_Airfoil =
new vector<su2double>[nPlane];
19872 Variable_Airfoil =
new vector<su2double>[nPlane];
19876 for (iPlane = 0; iPlane < nPlane; iPlane++) {
19879 -1E6, 1E6, -1E6, 1E6, -1E6, 1E6, NULL, Xcoord_Airfoil[iPlane],
19880 Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane],
19881 Variable_Airfoil[iPlane], original_surface, config);
19891 Fuselage_File.open(
"fuselage_description.csv", ios::out);
19893 Fuselage_File <<
"\"x (in)\",\"Area (in^2)\",\"Length (in)\",\"Width (in)\",\"Waterline width (in)\",\"Height (in)\",\"Curvature (1/in)\",\"Generatrix Curve X (in)\",\"Generatrix Curve Y (in)\",\"Generatrix Curve Z (in)\",\"Axis Curve X (in)\",\"Axis Curve Y (in)\",\"Axis Curve Z (in)\"" << endl;
19895 Fuselage_File <<
"\"x (m)\",\"Area (m^2)\",\"Length (m)\",\"Width (m)\",\"Waterline width (m)\",\"Height (m)\",\"Curvature (1/in)\",\"Generatrix Curve X (m)\",\"Generatrix Curve Y (m)\",\"Generatrix Curve Z (m)\",\"Axis Curve X (m)\",\"Axis Curve Y (m)\",\"Axis Curve Z (m)\"" << endl;
19898 Fuselage_File.open(
"fuselage_description.dat", ios::out);
19899 Fuselage_File <<
"TITLE = \"Fuselage description\"" << endl;
19901 Fuselage_File <<
"VARIABLES = \"x (in)\",\"Area (in<sup>2</sup>)\",\"Length (in)\",\"Width (in)\",\"Waterline width (in)\",\"Height (in)\",\"Curvature (1/in)\",\"Generatrix Curve X (in)\",\"Generatrix Curve Y (in)\",\"Generatrix Curve Z (in)\",\"Axis Curve X (in)\",\"Axis Curve Y (in)\",\"Axis Curve Z (in)\"" << endl;
19903 Fuselage_File <<
"VARIABLES = \"x (m)\",\"Area (m<sup>2</sup>)\",\"Length (m)\",\"Width (m)\",\"Waterline width (m)\",\"Height (m)\",\"Curvature (1/m)\",\"Generatrix Curve X (m)\",\"Generatrix Curve Y (m)\",\"Generatrix Curve Z (m)\",\"Axis Curve X (m)\",\"Axis Curve Y (m)\",\"Axis Curve Z (m)\"" << endl;
19904 Fuselage_File <<
"ZONE T= \"Baseline fuselage\"" << endl;
19910 for (iPlane = 0; iPlane < nPlane; iPlane++) {
19912 for (iDim = 0; iDim <
nDim; iDim++) {
19913 LeadingEdge[iPlane][iDim] = 0.0;
19914 TrailingEdge[iPlane][iDim] = 0.0;
19917 Area[iPlane] = 0.0;
19918 Length[iPlane] = 0.0;
19919 Width[iPlane] = 0.0;
19920 WaterLineWidth[iPlane] = 0.0;
19921 Height[iPlane] = 0.0;
19923 if (Xcoord_Airfoil[iPlane].
size() > 1) {
19925 Compute_Fuselage_LeadingTrailing(LeadingEdge[iPlane], TrailingEdge[iPlane], Plane_P0[iPlane], Plane_Normal[iPlane], Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
19927 Area[iPlane] =
Compute_Area(Plane_P0[iPlane], Plane_Normal[iPlane], config, Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
19929 Length[iPlane] =
Compute_Length(Plane_P0[iPlane], Plane_Normal[iPlane], config, Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
19931 Width[iPlane] =
Compute_Width(Plane_P0[iPlane], Plane_Normal[iPlane], Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
19933 WaterLineWidth[iPlane] =
Compute_WaterLineWidth(Plane_P0[iPlane], Plane_Normal[iPlane], config, Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
19935 Height[iPlane] =
Compute_Height(Plane_P0[iPlane], Plane_Normal[iPlane], Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
19943 for (iPlane = 0; iPlane < nPlane; iPlane++) {
19945 Curvature[iPlane] = 0.0;
19947 if (Xcoord_Airfoil[iPlane].
size() > 1) {
19949 if ((iPlane == 0) || (iPlane == nPlane-1)) Curvature[iPlane] = 0.0;
19950 else Curvature[iPlane] =
Compute_Curvature(LeadingEdge[iPlane-1], TrailingEdge[iPlane-1],
19951 LeadingEdge[iPlane], TrailingEdge[iPlane],
19952 LeadingEdge[iPlane+1], TrailingEdge[iPlane+1]);
19961 if ((Xcoord_Airfoil[0].
size() != 0) && (Xcoord_Airfoil[1].
size() != 0)) {
19962 Curvature[0] = Curvature[1];
19964 if ((Xcoord_Airfoil[nPlane-1].
size() != 0) && (Xcoord_Airfoil[nPlane-2].
size() != 0)) {
19965 Curvature[nPlane-1] = Curvature[nPlane-2];
19971 for (iPlane = 0; iPlane < nPlane; iPlane++) {
19972 if (Xcoord_Airfoil[iPlane].
size() > 1) {
19974 Fuselage_File << -Ycoord_Airfoil[iPlane][0] <<
", "<< Area[iPlane] <<
", "<< Length[iPlane] <<
", "<< Width[iPlane] <<
", "<< WaterLineWidth[iPlane] <<
", "<< Height[iPlane] <<
", "<< Curvature[iPlane]
19975 <<
", "<< -LeadingEdge[iPlane][1] <<
", "<< LeadingEdge[iPlane][0] <<
", "<< LeadingEdge[iPlane][2]
19976 <<
", "<< -TrailingEdge[iPlane][1] <<
", "<< TrailingEdge[iPlane][0] <<
", "<< TrailingEdge[iPlane][2] << endl;
19979 Fuselage_File << -Ycoord_Airfoil[iPlane][0] <<
" "<< Area[iPlane] <<
" "<< Length[iPlane] <<
" "<< Width[iPlane] <<
" "<< WaterLineWidth[iPlane] <<
" "<< Height[iPlane] <<
" "<< Curvature[iPlane]
19980 <<
" "<< -LeadingEdge[iPlane][1] <<
" "<< LeadingEdge[iPlane][0] <<
" "<< LeadingEdge[iPlane][2]
19981 <<
" "<< -TrailingEdge[iPlane][1] <<
" "<< TrailingEdge[iPlane][0] <<
" "<< TrailingEdge[iPlane][2] << endl;
19986 Fuselage_File.close();
19988 Section_File.open(
"fuselage_slices.dat", ios::out);
19990 for (iPlane = 0; iPlane < nPlane; iPlane++) {
19993 Section_File <<
"TITLE = \"Aircraft Slices\"" << endl;
19995 Section_File <<
"VARIABLES = \"x (in)\", \"y (in)\", \"z (in)\"" << endl;
19996 else Section_File <<
"VARIABLES = \"x (m)\", \"y (m)\", \"z (m)\"" << endl;
19999 if (Xcoord_Airfoil[iPlane].
size() > 1) {
20001 Section_File <<
"ZONE T=\"X = " << -Ycoord_Airfoil[iPlane][0] <<
" \", I= " << Ycoord_Airfoil[iPlane].size() <<
", F=POINT" << endl;
20003 for (iVertex = 0; iVertex < Xcoord_Airfoil[iPlane].size(); iVertex++) {
20007 Section_File << -Ycoord_Airfoil[iPlane][iVertex] <<
" " << Xcoord_Airfoil[iPlane][iVertex] <<
" " << Zcoord_Airfoil[iPlane][iVertex] << endl;
20013 Section_File.close();
20018 Fuselage_Volume = 0.0;
20019 for (iPlane = 0; iPlane < nPlane-2; iPlane+=2) {
20020 if (Xcoord_Airfoil[iPlane].
size() > 1) {
20021 Fuselage_Volume += (1.0/3.0)*dPlane*(Area[iPlane] + 4.0*Area[iPlane+1] + Area[iPlane+2]);
20027 Fuselage_WettedArea = 0.0;
20028 if (Xcoord_Airfoil[0].
size() > 1) Fuselage_WettedArea += (1.0/2.0)*dPlane*Length[0];
20029 for (iPlane = 1; iPlane < nPlane-1; iPlane++) {
20030 if (Xcoord_Airfoil[iPlane].
size() > 1) {
20031 Fuselage_WettedArea += dPlane*Length[iPlane];
20034 if (Xcoord_Airfoil[nPlane-1].
size() > 1) Fuselage_WettedArea += (1.0/2.0)*dPlane*Length[nPlane-1];
20038 Fuselage_MaxWidth = -1E6; Fuselage_MinWidth = 1E6;
20039 Fuselage_MaxWaterLineWidth = -1E6; Fuselage_MinWaterLineWidth = 1E6;
20040 Fuselage_MaxHeight = -1E6; Fuselage_MinHeight = 1E6;
20041 Fuselage_MaxCurvature = -1E6;
20043 for (iPlane = 0; iPlane < nPlane; iPlane++) {
20044 if (Width[iPlane] != 0.0) Fuselage_MinWidth = min(Fuselage_MinWidth, Width[iPlane]);
20045 Fuselage_MaxWidth = max(Fuselage_MaxWidth, Width[iPlane]);
20046 if (WaterLineWidth[iPlane] != 0.0) Fuselage_MinWaterLineWidth = min(Fuselage_MinWaterLineWidth, WaterLineWidth[iPlane]);
20047 Fuselage_MaxWaterLineWidth = max(Fuselage_MaxWaterLineWidth, WaterLineWidth[iPlane]);
20048 if (Height[iPlane] != 0.0) Fuselage_MinHeight = min(Fuselage_MinHeight, Height[iPlane]);
20049 Fuselage_MaxHeight = max(Fuselage_MaxHeight, Height[iPlane]);
20050 Fuselage_MaxCurvature = max(Fuselage_MaxCurvature, Curvature[iPlane]);
20057 delete [] Xcoord_Airfoil;
20058 delete [] Ycoord_Airfoil;
20059 delete [] Zcoord_Airfoil;
20060 delete [] Variable_Airfoil;
20062 for (iPlane = 0; iPlane < nPlane; iPlane++)
20063 delete [] LeadingEdge[iPlane];
20064 delete [] LeadingEdge;
20066 for (iPlane = 0; iPlane < nPlane; iPlane++)
20067 delete [] TrailingEdge[iPlane];
20068 delete [] TrailingEdge;
20070 for (iPlane = 0; iPlane < nPlane; iPlane++)
20071 delete [] Plane_P0[iPlane];
20072 delete [] Plane_P0;
20074 for (iPlane = 0; iPlane < nPlane; iPlane++)
20075 delete [] Plane_Normal[iPlane];
20076 delete [] Plane_Normal;
20081 delete [] WaterLineWidth;
20083 delete [] Curvature;
20094 unsigned short iPlane, iDim, nPlane = 0;
20095 unsigned long iVertex;
20096 su2double Angle, MinAngle, MaxAngle, dAngle, *Area, *MaxThickness, *ToC, *Chord, *LERadius, *Twist;
20097 vector<su2double> *Xcoord_Airfoil, *Ycoord_Airfoil, *Zcoord_Airfoil, *Variable_Airfoil;
20098 ofstream Nacelle_File, Section_File;
20115 for (iPlane = 0; iPlane < nPlane; iPlane++ )
20119 for (iPlane = 0; iPlane < nPlane; iPlane++ )
20123 for (iPlane = 0; iPlane < nPlane; iPlane++ )
20127 for (iPlane = 0; iPlane < nPlane; iPlane++ )
20131 dAngle = fabs((MaxAngle - MinAngle)/
su2double(nPlane-1));
20133 for (iPlane = 0; iPlane < nPlane; iPlane++) {
20134 Plane_Normal[iPlane][0] = 0.0; Plane_P0[iPlane][0] = 0.0;
20135 Plane_Normal[iPlane][1] = 0.0; Plane_P0[iPlane][1] = 0.0;
20136 Plane_Normal[iPlane][2] = 0.0; Plane_P0[iPlane][2] = 0.0;
20140 Angle = MinAngle + iPlane*dAngle*
PI_NUMBER/180.0;
20142 if (Angle <= 0) Angle = 1E-6;
20143 if (Angle >= 360) Angle = 359.999999;
20145 Plane_Normal[iPlane][0] = 0.0;
20146 Plane_Normal[iPlane][1] = -sin(Angle);
20147 Plane_Normal[iPlane][2] = cos(Angle);
20152 su2double Plane_NormalX_Tilt = Plane_Normal[iPlane][0]*cos(Tilt_Angle) + Plane_Normal[iPlane][2]*sin(Tilt_Angle);
20153 su2double Plane_NormalY_Tilt = Plane_Normal[iPlane][1];
20154 su2double Plane_NormalZ_Tilt = Plane_Normal[iPlane][2]*cos(Tilt_Angle) - Plane_Normal[iPlane][0]*sin(Tilt_Angle);
20159 su2double Plane_NormalX_Tilt_Toe = Plane_NormalX_Tilt*cos(Toe_Angle) - Plane_NormalY_Tilt*sin(Toe_Angle);
20160 su2double Plane_NormalY_Tilt_Toe = Plane_NormalX_Tilt*sin(Toe_Angle) + Plane_NormalY_Tilt*cos(Toe_Angle);
20161 su2double Plane_NormalZ_Tilt_Toe = Plane_NormalZ_Tilt;
20165 Plane_Normal[iPlane][0] = Plane_NormalX_Tilt_Toe;
20166 Plane_Normal[iPlane][1] = Plane_NormalY_Tilt_Toe;
20167 Plane_Normal[iPlane][2] = Plane_NormalZ_Tilt_Toe;
20179 Xcoord_Airfoil =
new vector<su2double>[nPlane];
20180 Ycoord_Airfoil =
new vector<su2double>[nPlane];
20181 Zcoord_Airfoil =
new vector<su2double>[nPlane];
20182 Variable_Airfoil =
new vector<su2double>[nPlane];
20186 for (iPlane = 0; iPlane < nPlane; iPlane++) {
20189 -1E6, 1E6, -1E6, 1E6, -1E6, 1E6, NULL, Xcoord_Airfoil[iPlane],
20190 Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane],
20191 Variable_Airfoil[iPlane], original_surface, config);
20202 Nacelle_File.open(
"nacelle_description.csv", ios::out);
20204 Nacelle_File <<
"\"Theta (deg)\",\"Area (in^2)\",\"Max. Thickness (in)\",\"Chord (in)\",\"Leading Edge Radius (1/in)\",\"Max. Thickness/Chord\",\"Twist (deg)\",\"Leading Edge XLoc\",\"Leading Edge ZLoc\",\"Trailing Edge XLoc\",\"Trailing Edge ZLoc\"" << endl;
20206 Nacelle_File <<
"\"Theta (deg)\",\"Area (m^2)\",\"Max. Thickness (m)\",\"Chord (m)\",\"Leading Edge Radius (1/m)\",\"Max. Thickness/Chord\",\"Twist (deg)\",\"Curvature (1/in)\",\"Dihedral (deg)\",\"Leading Edge XLoc\",\"Leading Edge ZLoc\",\"Trailing Edge XLoc\",\"Trailing Edge ZLoc\"" << endl;
20209 Nacelle_File.open(
"nacelle_description.dat", ios::out);
20210 Nacelle_File <<
"TITLE = \"Nacelle description\"" << endl;
20212 Nacelle_File <<
"VARIABLES = \"<greek>q</greek> (deg)\",\"Area (in<sup>2</sup>)\",\"Max. Thickness (in)\",\"Chord (in)\",\"Leading Edge Radius (1/in)\",\"Max. Thickness/Chord\",\"Twist (deg)\",\"Leading Edge XLoc\",\"Leading Edge ZLoc\",\"Trailing Edge XLoc\",\"Trailing Edge ZLoc\"" << endl;
20214 Nacelle_File <<
"VARIABLES = \"<greek>q</greek> (deg)\",\"Area (m<sup>2</sup>)\",\"Max. Thickness (m)\",\"Chord (m)\",\"Leading Edge Radius (1/m)\",\"Max. Thickness/Chord\",\"Twist (deg)\",\"Leading Edge XLoc\",\"Leading Edge ZLoc\",\"Trailing Edge XLoc\",\"Trailing Edge ZLoc\"" << endl;
20215 Nacelle_File <<
"ZONE T= \"Baseline nacelle\"" << endl;
20221 for (iPlane = 0; iPlane < nPlane; iPlane++) {
20223 for (iDim = 0; iDim <
nDim; iDim++) {
20224 LeadingEdge[iPlane][iDim] = 0.0;
20225 TrailingEdge[iPlane][iDim] = 0.0;
20228 Area[iPlane] = 0.0;
20229 MaxThickness[iPlane] = 0.0;
20230 Chord[iPlane] = 0.0;
20231 LERadius[iPlane] = 0.0;
20233 Twist[iPlane] = 0.0;
20235 if (Xcoord_Airfoil[iPlane].
size() > 1) {
20237 Compute_Wing_LeadingTrailing(LeadingEdge[iPlane], TrailingEdge[iPlane], Plane_P0[iPlane], Plane_Normal[iPlane], Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
20239 Area[iPlane] =
Compute_Area(Plane_P0[iPlane], Plane_Normal[iPlane], config, Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
20241 MaxThickness[iPlane] =
Compute_MaxThickness(Plane_P0[iPlane], Plane_Normal[iPlane], config, Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
20243 Chord[iPlane] =
Compute_Chord(Plane_P0[iPlane], Plane_Normal[iPlane], Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
20245 Twist[iPlane] =
Compute_Twist(Plane_P0[iPlane], Plane_Normal[iPlane], Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
20247 LERadius[iPlane] =
Compute_LERadius(Plane_P0[iPlane], Plane_Normal[iPlane], Xcoord_Airfoil[iPlane], Ycoord_Airfoil[iPlane], Zcoord_Airfoil[iPlane]);
20249 ToC[iPlane] = MaxThickness[iPlane] / Chord[iPlane];
20258 for (iPlane = 0; iPlane < nPlane; iPlane++) {
20260 su2double theta_deg = atan2(Plane_Normal[iPlane][1], -Plane_Normal[iPlane][2])/
PI_NUMBER*180 + 180;
20262 if (Xcoord_Airfoil[iPlane].
size() > 1) {
20264 Nacelle_File << theta_deg <<
", "<< Area[iPlane] <<
", "<< MaxThickness[iPlane] <<
", "<< Chord[iPlane] <<
", "<< LERadius[iPlane] <<
", "<< ToC[iPlane]
20265 <<
", "<< Twist[iPlane] <<
", "<< LeadingEdge[iPlane][0] <<
", "<< LeadingEdge[iPlane][2]
20266 <<
", "<< TrailingEdge[iPlane][0] <<
", "<< TrailingEdge[iPlane][2] << endl;
20269 Nacelle_File << theta_deg <<
" "<< Area[iPlane] <<
" "<< MaxThickness[iPlane] <<
" "<< Chord[iPlane] <<
" "<< LERadius[iPlane] <<
" "<< ToC[iPlane]
20270 <<
" "<< Twist[iPlane] <<
" "<< LeadingEdge[iPlane][0] <<
" "<< LeadingEdge[iPlane][2]
20271 <<
" "<< TrailingEdge[iPlane][0] <<
" "<< TrailingEdge[iPlane][2] << endl;
20278 Nacelle_File.close();
20280 Section_File.open(
"nacelle_slices.dat", ios::out);
20282 for (iPlane = 0; iPlane < nPlane; iPlane++) {
20285 Section_File <<
"TITLE = \"Nacelle Slices\"" << endl;
20287 Section_File <<
"VARIABLES = \"x (in)\", \"y (in)\", \"z (in)\", \"x<sub>2D</sub>/c\", \"y<sub>2D</sub>/c\"" << endl;
20288 else Section_File <<
"VARIABLES = \"x (m)\", \"y (m)\", \"z (m)\", \"x<sub>2D</sub>/c\", \"y<sub>2D</sub>/c\"" << endl;
20291 if (Xcoord_Airfoil[iPlane].
size() > 1) {
20293 su2double theta_deg = atan2(Plane_Normal[iPlane][1], -Plane_Normal[iPlane][2])/
PI_NUMBER*180 + 180;
20296 Section_File <<
"ZONE T=\"<greek>q</greek> = " << theta_deg <<
" deg\", I= " << Xcoord_Airfoil[iPlane].size() <<
", F=POINT" << endl;
20298 for (iVertex = 0; iVertex < Xcoord_Airfoil[iPlane].size(); iVertex++) {
20302 su2double XValue_ = Xcoord_Airfoil[iPlane][iVertex] - LeadingEdge[iPlane][0];
20303 su2double ZValue_ = Zcoord_Airfoil[iPlane][iVertex] - LeadingEdge[iPlane][2];
20310 su2double XValue = (XValue_*ValCos - ZValue_*ValSin) / Chord[iPlane];
20311 su2double ZValue = (ZValue_*ValCos + XValue_*ValSin) / Chord[iPlane];
20314 su2double YCoord = (Ycoord_Airfoil[iPlane][iVertex]*cos(Angle) - Zcoord_Airfoil[iPlane][iVertex]*sin(Angle)) + config->
GetNacelleLocation(1);
20315 su2double ZCoord = (Zcoord_Airfoil[iPlane][iVertex]*cos(Angle) + Ycoord_Airfoil[iPlane][iVertex]*sin(Angle)) + config->
GetNacelleLocation(2);
20319 Section_File << XCoord <<
" " << YCoord <<
" " << ZCoord <<
" " << XValue <<
" " << ZValue << endl;
20325 Section_File.close();
20330 Nacelle_Volume = 0.0;
20331 for (iPlane = 0; iPlane < nPlane-2; iPlane+=2) {
20332 if (Xcoord_Airfoil[iPlane].
size() > 1) {
20333 Nacelle_Volume += (1.0/3.0)*dAngle*(Area[iPlane] + 4.0*Area[iPlane+1] + Area[iPlane+2]);
20339 Nacelle_MaxMaxThickness = -1E6; Nacelle_MinMaxThickness = 1E6; Nacelle_MinChord = 1E6; Nacelle_MaxChord = -1E6;
20340 Nacelle_MinLERadius = 1E6; Nacelle_MaxLERadius = -1E6; Nacelle_MinToC = 1E6; Nacelle_MaxToC = -1E6;
20341 Nacelle_MaxTwist = -1E6;
20343 for (iPlane = 0; iPlane < nPlane; iPlane++) {
20344 if (MaxThickness[iPlane] != 0.0) Nacelle_MinMaxThickness = min(Nacelle_MinMaxThickness, MaxThickness[iPlane]);
20345 Nacelle_MaxMaxThickness = max(Nacelle_MaxMaxThickness, MaxThickness[iPlane]);
20346 if (Chord[iPlane] != 0.0) Nacelle_MinChord = min(Nacelle_MinChord, Chord[iPlane]);
20347 Nacelle_MaxChord = max(Nacelle_MaxChord, Chord[iPlane]);
20348 if (LERadius[iPlane] != 0.0) Nacelle_MinLERadius = min(Nacelle_MinLERadius, LERadius[iPlane]);
20349 Nacelle_MaxLERadius = max(Nacelle_MaxLERadius, LERadius[iPlane]);
20350 if (ToC[iPlane] != 0.0) Nacelle_MinToC = min(Nacelle_MinToC, ToC[iPlane]);
20351 Nacelle_MaxToC = max(Nacelle_MaxToC, ToC[iPlane]);
20352 Nacelle_ObjFun_MinToC = sqrt((Nacelle_MinToC - 0.07)*(Nacelle_MinToC - 0.07));
20353 Nacelle_MaxTwist = max(Nacelle_MaxTwist, fabs(Twist[iPlane]));
20360 delete [] Xcoord_Airfoil;
20361 delete [] Ycoord_Airfoil;
20362 delete [] Zcoord_Airfoil;
20363 delete [] Variable_Airfoil;
20365 for (iPlane = 0; iPlane < nPlane; iPlane++)
20366 delete [] LeadingEdge[iPlane];
20367 delete [] LeadingEdge;
20369 for (iPlane = 0; iPlane < nPlane; iPlane++)
20370 delete [] TrailingEdge[iPlane];
20371 delete [] TrailingEdge;
20373 for (iPlane = 0; iPlane < nPlane; iPlane++)
20374 delete [] Plane_P0[iPlane];
20375 delete [] Plane_P0;
20377 for (iPlane = 0; iPlane < nPlane; iPlane++)
20378 delete [] Plane_Normal[iPlane];
20379 delete [] Plane_Normal;
20382 delete [] MaxThickness;
20384 delete [] LERadius;
20395 CGeometry *fine_grid = geometry[iZone][iInst][iMesh-1];
20396 CConfig *config = config_container[iZone];
20400 unsigned long iPoint, Index_CoarseCV, CVPoint, iElem, iVertex, jPoint, iteration, nVertexS, nVertexR, nBufferS_Vector, nBufferR_Vector, iParent, jVertex, *Buffer_Receive_Parent = NULL, *Buffer_Send_Parent = NULL, *Buffer_Receive_Children = NULL, *Buffer_Send_Children = NULL, *Parent_Remote = NULL, *Children_Remote = NULL, *Parent_Local = NULL, *Children_Local = NULL, Local_nPointCoarse, Local_nPointFine, Global_nPointCoarse, Global_nPointFine;;
20402 bool agglomerate_seed =
true;
20403 unsigned short nChildren, iNode, counter, iMarker, jMarker, priority, MarkerS, MarkerR, *nChildren_MPI;
20404 vector<unsigned long> Suitable_Indirect_Neighbors, Aux_Parent;
20405 vector<unsigned long>::iterator it;
20409 unsigned short *copy_marker =
new unsigned short [nMarker_Max];
20412 int send_to, receive_from;
20428 for (iPoint = 0; iPoint < fine_grid->
GetnPoint(); iPoint ++)
20431 for (iElem = 0; iElem < fine_grid->
GetnElem(); iElem++) {
20434 for (iNode = 0; iNode < fine_grid->
elem[iElem]->
GetnNodes(); iNode++) {
20449 for (iPoint = 0; iPoint < fine_grid->
GetnPoint(); iPoint ++) {
20460 Index_CoarseCV = 0;
20464 for (iMarker = 0; iMarker < fine_grid->
GetnMarker(); iMarker++) {
20466 for (iVertex = 0; iVertex < fine_grid->
GetnVertex(iMarker); iVertex++) {
20485 agglomerate_seed =
true; counter = 0; marker_seed = iMarker;
20490 for (jMarker = 0; jMarker < fine_grid->
GetnMarker(); jMarker ++)
20492 copy_marker[counter] = jMarker;
20500 if (counter == 1) agglomerate_seed =
true;
20505 if (counter == 2) {
20508 else agglomerate_seed =
false;
20513 if (counter > 2) agglomerate_seed =
false;
20517 if (agglomerate_seed) {
20521 for (iNode = 0; iNode < fine_grid->
node[iPoint]->
GetnPoint(); iNode ++) {
20541 Suitable_Indirect_Neighbors.clear();
20548 for (iNode = 0; iNode < Suitable_Indirect_Neighbors.size(); iNode ++) {
20550 CVPoint = Suitable_Indirect_Neighbors[iNode];
20587 for (iMarker = 0; iMarker < fine_grid->
GetnMarker(); iMarker++)
20588 for (iVertex = 0; iVertex < fine_grid->
GetnVertex(iMarker); iVertex++) {
20601 for (iPoint = 0; iPoint < fine_grid->
GetnPoint(); iPoint ++) {
20616 for (iNode = 0; iNode < fine_grid->
node[iPoint]->
GetnPoint(); iNode ++) {
20620 MGQueue_InnerCV.
MoveCV(iPoint, priority);
20629 iPoint = MGQueue_InnerCV.
NextCV();
20652 MGQueue_InnerCV.
Update(iPoint, fine_grid);
20656 for (iNode = 0; iNode < fine_grid->
node[iPoint]->
GetnPoint(); iNode ++) {
20678 MGQueue_InnerCV.
Update(CVPoint, fine_grid);
20686 Suitable_Indirect_Neighbors.clear();
20692 for (iNode = 0; iNode < Suitable_Indirect_Neighbors.size(); iNode ++) {
20694 CVPoint = Suitable_Indirect_Neighbors[iNode];
20718 MGQueue_InnerCV.
Update(CVPoint, fine_grid);
20733 MGQueue_InnerCV.
MoveCV(iPoint, -1);
20740 for (iPoint = 0; iPoint < fine_grid->
GetnPoint(); iPoint ++) {
20758 unsigned long iFinePoint, iFinePoint_Neighbor, iCoarsePoint, iCoarsePoint_Complete;
20759 unsigned short iChildren;
20763 for (iCoarsePoint = 0; iCoarsePoint <
nPointDomain; iCoarsePoint ++) {
20766 for (iNode = 0; iNode < fine_grid->
node[iFinePoint]->
GetnPoint(); iNode ++) {
20767 iFinePoint_Neighbor = fine_grid->
node[iFinePoint]->
GetPoint(iNode);
20769 if (iParent != iCoarsePoint)
node[iCoarsePoint]->
SetPoint(iParent);
20776 for (iCoarsePoint = 0; iCoarsePoint <
nPointDomain; iCoarsePoint ++) {
20782 iCoarsePoint_Complete =
node[iCoarsePoint]->
GetPoint(0);
20840 for (iCoarsePoint = 0; iCoarsePoint <
nPointDomain; iCoarsePoint ++) {
20848 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
20853 MarkerS = iMarker; MarkerR = iMarker+1;
20860 nVertexS = fine_grid->
nVertex[MarkerS]; nVertexR = fine_grid->
nVertex[MarkerR];
20861 nBufferS_Vector = nVertexS; nBufferR_Vector = nVertexR;
20865 Buffer_Receive_Children =
new unsigned long [nBufferR_Vector];
20866 Buffer_Send_Children =
new unsigned long [nBufferS_Vector];
20868 Buffer_Receive_Parent =
new unsigned long [nBufferR_Vector];
20869 Buffer_Send_Parent =
new unsigned long [nBufferS_Vector];
20873 for (iVertex = 0; iVertex < nVertexS; iVertex++) {
20875 Buffer_Send_Children[iVertex] = iPoint;
20887 for (iVertex = 0; iVertex < nVertexR; iVertex++) {
20888 Buffer_Receive_Children[iVertex] = Buffer_Send_Children[iVertex];
20889 Buffer_Receive_Parent[iVertex] = Buffer_Send_Parent[iVertex];
20895 delete [] Buffer_Send_Children;
20896 delete [] Buffer_Send_Parent;
20900 Aux_Parent.clear();
20901 for (iVertex = 0; iVertex < nVertexR; iVertex++)
20902 Aux_Parent.push_back (Buffer_Receive_Parent[iVertex]);
20904 sort(Aux_Parent.begin(), Aux_Parent.end());
20905 it = unique(Aux_Parent.begin(), Aux_Parent.end());
20906 Aux_Parent.resize(it - Aux_Parent.begin());
20910 Parent_Remote =
new unsigned long[nVertexR];
20911 Children_Remote =
new unsigned long[nVertexR];
20912 Parent_Local =
new unsigned long[nVertexR];
20913 Children_Local =
new unsigned long[nVertexR];
20917 for (iVertex = 0; iVertex < nVertexR; iVertex++) {
20919 Parent_Remote[iVertex] = Buffer_Receive_Parent[iVertex];
20923 for (jVertex = 0; jVertex < Aux_Parent.size(); jVertex++) {
20924 if (Parent_Remote[iVertex] == Aux_Parent[jVertex]) {
20925 Parent_Local[iVertex] = jVertex + Index_CoarseCV;
20930 Children_Remote[iVertex] = Buffer_Receive_Children[iVertex];
20931 Children_Local[iVertex] = fine_grid->
vertex[MarkerR][iVertex]->
GetNode();
20935 Index_CoarseCV += Aux_Parent.size();
20937 nChildren_MPI =
new unsigned short [Index_CoarseCV];
20938 for (iParent = 0; iParent < Index_CoarseCV; iParent++)
20939 nChildren_MPI[iParent] = 0;
20942 for (iVertex = 0; iVertex < nVertexR; iVertex++) {
20947 fine_grid->
node[Children_Local[iVertex]]->
SetParent_CV(Parent_Local[iVertex]);
20948 node[Parent_Local[iVertex]]->
SetChildren_CV(nChildren_MPI[Parent_Local[iVertex]], Children_Local[iVertex]);
20949 nChildren_MPI[Parent_Local[iVertex]]++;
20957 delete[] nChildren_MPI;
20958 delete[] Parent_Remote;
20959 delete[] Children_Remote;
20960 delete[] Parent_Local;
20961 delete[] Children_Local;
20965 delete [] Buffer_Receive_Children;
20966 delete [] Buffer_Receive_Parent;
20974 nPoint = Index_CoarseCV;
20978 Local_nPointCoarse =
nPoint;
20979 Local_nPointFine = fine_grid->
GetnPoint();
20985 Global_nPointCoarse = Local_nPointCoarse;
20986 Global_nPointFine = Local_nPointFine;
20989 su2double Coeff = 1.0, CFL = 0.0, factor = 1.5;
20994 CFL = factor*config->
GetCFL(iMesh-1)/Coeff;
20995 config->
SetCFL(iMesh, CFL);
21000 if (((
nDim == 2) && (ratio < 2.5)) ||
21001 ((
nDim == 3) && (ratio < 2.5))) {
21006 if (iMesh == 1) cout <<
"MG level: "<< iMesh-1 <<
" -> CVs: " << Global_nPointFine <<
". Agglomeration rate 1/1.00. CFL "<< config->
GetCFL(iMesh-1) <<
"." << endl;
21007 cout <<
"MG level: "<< iMesh <<
" -> CVs: " << Global_nPointCoarse <<
". Agglomeration rate 1/" << ratio <<
". CFL "<< CFL <<
"." << endl;
21011 delete [] copy_marker;
21022 bool agglomerate_CV =
false;
21023 unsigned short counter, jMarker;
21027 unsigned short *copy_marker =
new unsigned short [nMarker_Max];
21043 for (jMarker = 0; jMarker < fine_grid->
GetnMarker(); jMarker ++)
21045 copy_marker[counter] = jMarker;
21054 if (counter == 1) {
21058 if (copy_marker[0] == marker_seed)
21059 agglomerate_CV =
true;
21064 agglomerate_CV =
true;
21070 if (counter == 2) {
21080 agglomerate_CV =
true;
21089 else { agglomerate_CV =
true; }
21093 delete [] copy_marker;
21095 return agglomerate_CV;
21106 bool Volume =
true;
21109 if ( ratio > limit ) Volume =
false;
21113 bool Stretching =
true;
21131 return (Stretching && Volume);
21136 unsigned long Index_CoarseCV,
CGeometry *fine_grid) {
21138 unsigned long jPoint, kPoint, lPoint;
21139 unsigned short iNode, jNode, iNeighbor, jNeighbor, kNode;
21140 bool SecondNeighborSeed, ThirdNeighborSeed;
21141 vector<unsigned long>::iterator it;
21145 vector<unsigned long> First_Neighbor_Points;
21146 First_Neighbor_Points.push_back(iPoint);
21147 for (iNode = 0; iNode < fine_grid->
node[iPoint]->
GetnPoint(); iNode ++) {
21149 First_Neighbor_Points.push_back(jPoint);
21154 vector<unsigned long> Second_Neighbor_Points, Second_Origin_Points, Suitable_Second_Neighbors;
21156 for (iNode = 0; iNode < fine_grid->
node[iPoint]->
GetnPoint(); iNode ++) {
21159 for (jNode = 0; jNode < fine_grid->
node[jPoint]->
GetnPoint(); jNode ++) {
21164 SecondNeighborSeed =
true;
21165 for (iNeighbor = 0; iNeighbor < First_Neighbor_Points.size(); iNeighbor ++)
21166 if (kPoint == First_Neighbor_Points[iNeighbor]) {
21167 SecondNeighborSeed =
false;
break;
21170 if (SecondNeighborSeed) {
21171 Second_Neighbor_Points.push_back(kPoint);
21172 Second_Origin_Points.push_back(jPoint);
21180 for (iNeighbor = 0; iNeighbor < Second_Neighbor_Points.size(); iNeighbor ++)
21182 for (jNeighbor = 0; jNeighbor < Second_Neighbor_Points.size(); jNeighbor ++)
21186 if ((Second_Neighbor_Points[iNeighbor] == Second_Neighbor_Points[jNeighbor]) &&
21187 (Second_Origin_Points[iNeighbor] != Second_Origin_Points[jNeighbor]) &&
21188 (iNeighbor < jNeighbor)) {
21190 Suitable_Indirect_Neighbors->push_back(Second_Neighbor_Points[iNeighbor]);
21195 Suitable_Second_Neighbors.push_back(Second_Neighbor_Points[iNeighbor]);
21202 sort(Suitable_Second_Neighbors.begin(), Suitable_Second_Neighbors.end());
21203 it = unique(Suitable_Second_Neighbors.begin(), Suitable_Second_Neighbors.end());
21204 Suitable_Second_Neighbors.resize(it - Suitable_Second_Neighbors.begin());
21208 sort(First_Neighbor_Points.begin(), First_Neighbor_Points.end());
21209 it = unique(First_Neighbor_Points.begin(), First_Neighbor_Points.end());
21210 First_Neighbor_Points.resize(it - First_Neighbor_Points.begin());
21214 vector<unsigned long> Third_Neighbor_Points, Third_Origin_Points;
21216 for (jNode = 0; jNode < Suitable_Second_Neighbors.size(); jNode ++) {
21217 kPoint = Suitable_Second_Neighbors[jNode];
21219 for (kNode = 0; kNode < fine_grid->
node[kPoint]->
GetnPoint(); kNode ++) {
21224 ThirdNeighborSeed =
true;
21226 for (iNeighbor = 0; iNeighbor < First_Neighbor_Points.size(); iNeighbor ++)
21227 if (lPoint == First_Neighbor_Points[iNeighbor]) {
21228 ThirdNeighborSeed =
false;
21234 for (iNeighbor = 0; iNeighbor < Suitable_Second_Neighbors.size(); iNeighbor ++)
21235 if (lPoint == Suitable_Second_Neighbors[iNeighbor]) {
21236 ThirdNeighborSeed =
false;
21240 if (ThirdNeighborSeed) {
21241 Third_Neighbor_Points.push_back(lPoint);
21242 Third_Origin_Points.push_back(kPoint);
21250 for (iNeighbor = 0; iNeighbor < Third_Neighbor_Points.size(); iNeighbor ++)
21251 for (jNeighbor = 0; jNeighbor < Third_Neighbor_Points.size(); jNeighbor ++)
21255 if ((Third_Neighbor_Points[iNeighbor] == Third_Neighbor_Points[jNeighbor]) &&
21256 (Third_Origin_Points[iNeighbor] != Third_Origin_Points[jNeighbor]) &&
21257 (iNeighbor < jNeighbor)) {
21259 Suitable_Indirect_Neighbors->push_back(Third_Neighbor_Points[iNeighbor]);
21265 sort(Suitable_Indirect_Neighbors->begin(), Suitable_Indirect_Neighbors->end());
21266 it = unique(Suitable_Indirect_Neighbors->begin(), Suitable_Indirect_Neighbors->end());
21267 Suitable_Indirect_Neighbors->resize(it - Suitable_Indirect_Neighbors->begin());
21273 unsigned long iFinePoint, iFinePoint_Neighbor, iParent, iCoarsePoint;
21274 unsigned short iChildren, iNode;
21278 for (iCoarsePoint = 0; iCoarsePoint <
nPoint; iCoarsePoint ++) {
21281 for (iNode = 0; iNode < fine_grid->
node[iFinePoint]->
GetnPoint(); iNode ++) {
21282 iFinePoint_Neighbor = fine_grid->
node[iFinePoint]->
GetPoint(iNode);
21284 if (iParent != iCoarsePoint)
node[iCoarsePoint]->
SetPoint(iParent);
21292 for (iCoarsePoint = 0; iCoarsePoint <
nPoint; iCoarsePoint ++)
21298 unsigned long iVertex, iFinePoint, iCoarsePoint;
21299 unsigned short iMarker, iMarker_Tag, iChildren;
21306 for (iCoarsePoint = 0; iCoarsePoint <
nPoint; iCoarsePoint ++)
21319 for (iMarker_Tag = 0; iMarker_Tag < nMarker_Max; iMarker_Tag++)
21323 for (iMarker = 0; iMarker <
nMarker; iMarker++)
nVertex[iMarker] = 0;
21326 for (iCoarsePoint = 0; iCoarsePoint <
nPoint; iCoarsePoint ++) {
21327 if (
node[iCoarsePoint]->GetBoundary()) {
21330 for (iMarker = 0; iMarker <
nMarker; iMarker ++) {
21341 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
21346 for (iCoarsePoint = 0; iCoarsePoint <
nPoint; iCoarsePoint ++)
21347 if (
node[iCoarsePoint]->GetBoundary())
21348 for (iMarker = 0; iMarker <
nMarker; iMarker ++)
21351 for (iMarker = 0; iMarker <
nMarker; iMarker++)
nVertex[iMarker] = 0;
21353 for (iCoarsePoint = 0; iCoarsePoint <
nPoint; iCoarsePoint ++)
21354 if (
node[iCoarsePoint]->GetBoundary())
21357 for (iMarker = 0; iMarker < fine_grid->
GetnMarker(); iMarker ++) {
21364 unsigned long ChildVertex = fine_grid->
node[iFinePoint]->
GetVertex(iMarker);
21375 unsigned short iMarker;
21376 unsigned long iVertex, iPoint;
21377 int iProcessor =
size;
21379 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
21381 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
21383 if (
node[iPoint]->GetDomain()) {
21384 vertex[iMarker][iVertex]->
SetDonorPoint(iPoint,
node[iPoint]->GetGlobalIndex(), iVertex, iMarker, iProcessor);
21394 unsigned short iMarker;
21395 unsigned long iVertex, iPoint;
21396 int iProcessor =
size;
21398 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
21401 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
21403 if (
node[iPoint]->GetDomain()) {
21404 vertex[iMarker][iVertex]->
SetDonorPoint(iPoint,
node[iPoint]->GetGlobalIndex(), iVertex, iMarker, iProcessor);
21414 unsigned short iMarker;
21415 unsigned long iVertex, iPoint;
21416 int iProcessor =
size;
21418 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
21420 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
21422 if (
node[iPoint]->GetDomain()) {
21423 vertex[iMarker][iVertex]->
SetDonorPoint(iPoint,
node[iPoint]->GetGlobalIndex(), iVertex, iMarker, iProcessor);
21433 unsigned long iFinePoint, iFinePoint_Neighbor, iCoarsePoint, iEdge, iParent;
21434 long FineEdge, CoarseEdge;
21435 unsigned short iChildren, iNode, iDim;
21436 bool change_face_orientation;
21437 su2double *Normal, Coarse_Volume, Area, *NormalFace = NULL;
21441 for (iCoarsePoint = 0; iCoarsePoint <
nPoint; iCoarsePoint ++) {
21443 Coarse_Volume = 0.0;
21453 for (iEdge=0; iEdge <
nEdge; iEdge++)
21454 edge[iEdge]->SetZeroValues();
21457 for (iCoarsePoint = 0; iCoarsePoint <
nPoint; iCoarsePoint ++)
21461 for (iNode = 0; iNode < fine_grid->
node[iFinePoint]->
GetnPoint(); iNode ++) {
21462 iFinePoint_Neighbor = fine_grid->
node[iFinePoint]->
GetPoint(iNode);
21464 if ((iParent != iCoarsePoint) && (iParent < iCoarsePoint)) {
21466 FineEdge = fine_grid->
FindEdge(iFinePoint, iFinePoint_Neighbor);
21468 change_face_orientation =
false;
21469 if (iFinePoint < iFinePoint_Neighbor) change_face_orientation =
true;
21471 CoarseEdge =
FindEdge(iParent, iCoarsePoint);
21475 if (change_face_orientation) {
21476 for (iDim = 0; iDim <
nDim; iDim++) Normal[iDim] = -Normal[iDim];
21489 for (iEdge = 0; iEdge <
nEdge; iEdge++) {
21491 Area = 0.0;
for (iDim = 0; iDim <
nDim; iDim++) Area += NormalFace[iDim]*NormalFace[iDim];
21493 if (Area == 0.0)
for (iDim = 0; iDim <
nDim; iDim++) NormalFace[iDim] =
EPS*
EPS;
21499 unsigned long iCoarsePoint, iFinePoint, FineVertex, iVertex;
21500 unsigned short iMarker, iChildren, iDim;
21501 su2double *Normal, Area, *NormalFace = NULL;
21506 for (iMarker = 0; iMarker <
nMarker; iMarker++)
21507 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++)
21508 vertex[iMarker][iVertex]->SetZeroValues();
21511 for (iMarker = 0; iMarker <
nMarker; iMarker ++)
21512 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
21517 FineVertex = fine_grid->
node[iFinePoint]->
GetVertex(iMarker);
21527 for (iMarker = 0; iMarker <
nMarker; iMarker ++)
21528 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
21530 Area = 0.0;
for (iDim = 0; iDim <
nDim; iDim++) Area += NormalFace[iDim]*NormalFace[iDim];
21532 if (Area == 0.0)
for (iDim = 0; iDim <
nDim; iDim++) NormalFace[iDim] =
EPS*
EPS;
21538 unsigned long Point_Fine, Point_Coarse;
21539 unsigned short iChildren, iDim;
21541 su2double *Coordinates_Fine, *Coordinates;
21544 for (Point_Coarse = 0; Point_Coarse <
GetnPoint(); Point_Coarse++) {
21546 for (iDim = 0; iDim <
nDim; iDim++) Coordinates[iDim] = 0.0;
21550 Coordinates_Fine = geometry->
node[Point_Fine]->
GetCoord();
21551 for (iDim = 0; iDim <
nDim; iDim++)
21552 Coordinates[iDim] += Coordinates_Fine[iDim]*Area_Children/Area_Parent;
21554 for (iDim = 0; iDim <
nDim; iDim++)
21555 node[Point_Coarse]->
SetCoord(iDim, Coordinates[iDim]);
21557 delete[] Coordinates;
21562 unsigned long Point_Fine, Point_Coarse, iVertex;
21563 unsigned short iChildren;
21566 su2double WallHeatFlux_Fine, WallHeatFlux_Coarse;
21568 int numberVertexChildren;
21570 for(iVertex=0; iVertex <
nVertex[val_marker]; iVertex++){
21572 if (
node[Point_Coarse]->GetDomain()){
21574 WallHeatFlux_Coarse = 0.0;
21575 numberVertexChildren = 0;
21581 numberVertexChildren += 1;
21589 Vertex_Fine = geometry->
node[Point_Fine]->
GetVertex(val_marker);
21590 isVertex = (
node[Point_Fine]->
GetDomain() && Vertex_Fine != -1);
21595 WallHeatFlux_Coarse += WallHeatFlux_Fine*Area_Children/Area_Parent;
21608 unsigned long Point_Fine, Point_Coarse, iVertex;
21609 unsigned short iChildren;
21612 su2double WallTemperature_Fine, WallTemperature_Coarse;
21614 int numberVertexChildren;
21616 for(iVertex=0; iVertex <
nVertex[val_marker]; iVertex++){
21618 if (
node[Point_Coarse]->GetDomain()){
21620 WallTemperature_Coarse = 0.0;
21621 numberVertexChildren = 0;
21627 numberVertexChildren += 1;
21635 Vertex_Fine = geometry->
node[Point_Fine]->
GetVertex(val_marker);
21636 isVertex = (
node[Point_Fine]->
GetDomain() && Vertex_Fine != -1);
21641 WallTemperature_Coarse += WallTemperature_Fine*Area_Children/Area_Parent;
21654 unsigned long iPoint_Coarse;
21655 su2double *RotVel, Distance[3] = {0.0,0.0,0.0}, *Coord;
21656 su2double Center[3] = {0.0,0.0,0.0}, Omega[3] = {0.0,0.0,0.0}, L_Ref;
21671 for (iPoint_Coarse = 0; iPoint_Coarse <
GetnPoint(); iPoint_Coarse++) {
21679 Distance[0] = (Coord[0]-Center[0])/L_Ref;
21680 Distance[1] = (Coord[1]-Center[1])/L_Ref;
21681 Distance[2] = (Coord[2]-Center[2])/L_Ref;
21685 RotVel[0] = Omega[1]*(Distance[2]) - Omega[2]*(Distance[1]);
21686 RotVel[1] = Omega[2]*(Distance[0]) - Omega[0]*(Distance[2]);
21687 RotVel[2] = Omega[0]*(Distance[1]) - Omega[1]*(Distance[0]);
21701 unsigned long iPoint, iVertex;
21702 unsigned short iMarker, iMarkerShroud;
21710 for (iMarker = 0; iMarker <
nMarker; iMarker++){
21711 for(iMarkerShroud=0; iMarkerShroud < config->
GetnMarker_Shroud(); iMarkerShroud++){
21713 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
21725 unsigned long iPoint_Coarse;
21736 for (iPoint_Coarse = 0; iPoint_Coarse <
nPoint; iPoint_Coarse++) {
21740 for (iDim = 0; iDim <
nDim; iDim++)
21741 node[iPoint_Coarse]->SetGridVel(iDim,xDot[iDim]);
21751 su2double *Coord_nP1 = NULL, *Coord_n = NULL, *Coord_nM1 = NULL;
21753 unsigned long Point_Coarse;
21754 unsigned short iDim;
21758 for (Point_Coarse = 0; Point_Coarse <
GetnPoint(); Point_Coarse++) {
21772 for (iDim = 0; iDim <
nDim; iDim++) {
21774 GridVel = ( Coord_nP1[iDim] - Coord_n[iDim] ) / TimeStep;
21776 GridVel = ( 3.0*Coord_nP1[iDim] - 4.0*Coord_n[iDim]
21777 + 1.0*Coord_nM1[iDim] ) / (2.0*TimeStep);
21790 unsigned short iDim, iChild;
21791 unsigned long Point_Coarse, Point_Fine;
21792 su2double Area_Parent, Area_Child, Grid_Vel[3], *Grid_Vel_Fine;
21795 for (Point_Coarse = 0; Point_Coarse <
GetnPoint(); Point_Coarse++) {
21799 for (iDim = 0; iDim <
nDim; iDim++)
21800 Grid_Vel[iDim] = 0.0;
21808 for (iDim = 0; iDim <
nDim; iDim++)
21809 Grid_Vel[iDim] += Grid_Vel_Fine[iDim]*Area_Child/Area_Parent;
21813 for (iDim = 0; iDim <
nDim; iDim++)
21814 node[Point_Coarse]->SetGridVel(iDim, Grid_Vel[iDim]);
21821 unsigned short iMarker, iDim;
21822 unsigned long iPoint, iVertex;
21824 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
21830 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
21835 if (
node[iPoint]->GetDomain()) {
21838 su2double cos_max, scalar_prod, norm_vect, norm_Normal, cos_alpha, diff_coord;
21839 unsigned long Point_Normal = 0, jPoint;
21840 unsigned short iNeigh;
21843 for (iNeigh = 0; iNeigh <
node[iPoint]->
GetnPoint(); iNeigh++) {
21845 scalar_prod = 0.0; norm_vect = 0.0; norm_Normal = 0.0;
21846 for (iDim = 0; iDim <
nDim; iDim++) {
21848 scalar_prod += diff_coord*Normal[iDim];
21849 norm_vect += diff_coord*diff_coord;
21850 norm_Normal += Normal[iDim]*Normal[iDim];
21852 norm_vect = sqrt(norm_vect);
21853 norm_Normal = sqrt(norm_Normal);
21854 cos_alpha = scalar_prod/(norm_vect*norm_Normal);
21857 if (cos_alpha >= cos_max) {
21858 Point_Normal = jPoint;
21859 cos_max = cos_alpha;
21872 unsigned short iMarker = 0;
21873 su2double auxXCoord, auxYCoord, auxZCoord, *Face_Normal = NULL, auxArea, *Xcoord = NULL, *Ycoord = NULL, *Zcoord = NULL, *FaceArea = NULL;
21874 unsigned long jVertex, iVertex, ixCoord, iPoint, iVertex_Wall, nVertex_Wall = 0;
21878 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
21883 nVertex_Wall +=
nVertex[iMarker];
21891 FaceArea =
new su2double[nVertex_Wall];
21895 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
21900 for (iVertex = 0; iVertex <
nVertex[iMarker]; iVertex++) {
21906 FaceArea[iVertex_Wall] = fabs(Face_Normal[
nDim-1]);
21912 vector<su2double>::iterator IterXCoordList;
21914 for (iVertex = 0; iVertex < nVertex_Wall; iVertex++)
21930 unsigned long iCoord;
21933 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
21934 if (
node[iPoint]->GetDomain()) {
21936 for (ixCoord = 0; ixCoord <
XCoordList.size()-1 && loop_on; ixCoord++) {
21938 if (dist_ratio >= 0 && dist_ratio <= 1.0) {
21939 if (dist_ratio <= 0.5) iCoord = ixCoord;
21940 else iCoord = ixCoord+1;
21952 unsigned long auxPoint;
21954 for (ixCoord = 0; ixCoord <
XCoordList.size(); ixCoord++)
21955 for (iVertex = 0; iVertex <
Xcoord_plane[ixCoord].size(); iVertex++)
21956 for (jVertex = 0; jVertex <
Xcoord_plane[ixCoord].size() - 1 - iVertex; jVertex++)
21968 delete[] Xcoord;
delete[] Ycoord;
21969 if (Zcoord != NULL)
delete[] Zcoord;
21974 unsigned long nElem_new, nPoint_new, jPoint, iPoint, iElem, jElem, iVertex,
21977 unsigned short iMarker, nPeriodic = 0, iPeriodic;
21978 su2double *center, *angles, rotMatrix[3][3] = {{0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}},
21979 translation[3], *trans, theta, phi, psi, cosTheta, sinTheta, cosPhi, sinPhi, cosPsi, sinPsi,
21980 dx, dy, dz, rotCoord[3], *Coord_i;
21984 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++) {
21990 bool *CreateMirror =
new bool[nPeriodic+1];
21991 CreateMirror[0] =
false;
21992 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++) {
21993 if (iPeriodic <= nPeriodic/2) CreateMirror[iPeriodic] =
false;
21994 else CreateMirror[iPeriodic] =
true;
22006 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
22007 newElementsBound += nNewElem_BoundPer[iMarker];
22010 nElem_new = 0; nPoint_new = 0;
22011 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++) {
22012 if (CreateMirror[iPeriodic]) {
22013 nElem_new += geometry->
PeriodicElem[iPeriodic].size();
22014 nPoint_new += geometry->
PeriodicPoint[iPeriodic][0].size();
22018 cout <<
"Number of new points: " << nPoint_new <<
"." << endl;
22019 cout <<
"Number of new interior elements: " << nElem_new <<
"." << endl;
22020 cout <<
"Number of new boundary elements added to preexisting markers: " << newElementsBound <<
"." << endl;
22024 for (iElem = 0; iElem < geometry->
GetnElem(); iElem ++) {
22084 unsigned long *Index =
new unsigned long [geometry->
GetnPoint()];
22085 for (iPoint = 0; iPoint < geometry->
GetnPoint(); iPoint ++) Index[iPoint] = 0;
22087 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++) {
22088 if (CreateMirror[iPeriodic]) {
22089 for (iIndex = 0; iIndex < geometry->
PeriodicPoint[iPeriodic][0].size(); iIndex++) {
22091 Index[iPoint] = geometry->
PeriodicPoint[iPeriodic][1][iIndex];
22096 for (iMarker = 0; iMarker < geometry->
GetnMarker(); iMarker++)
22098 for (iVertex = 0; iVertex < geometry->
GetnVertex(iMarker); iVertex++) {
22101 Index[iPoint] = jPoint;
22107 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++) {
22108 if (CreateMirror[iPeriodic]) {
22109 for (iIndex = 0; iIndex < geometry->
PeriodicElem[iPeriodic].size(); iIndex++) {
22178 for (iPoint = 0; iPoint < geometry->
GetnPoint(); iPoint ++) {
22179 if (geometry->
GetnDim() == 2)
22182 if (geometry->
GetnDim() == 3)
22189 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++) {
22190 if (CreateMirror[iPeriodic]) {
22191 for (iIndex = 0; iIndex < geometry->
PeriodicPoint[iPeriodic][0].size(); iIndex++) {
22194 for (iMarker = 0; iMarker < geometry->
GetnMarker(); iMarker++)
22204 translation[0] = center[0] - trans[0];
22205 translation[1] = center[1] - trans[1];
22206 translation[2] = center[2] - trans[2];
22210 theta = -angles[0];
22214 cosTheta = cos(theta); cosPhi = cos(phi); cosPsi = cos(psi);
22215 sinTheta = sin(theta); sinPhi = sin(phi); sinPsi = sin(psi);
22219 rotMatrix[0][0] = cosPhi*cosPsi;
22220 rotMatrix[1][0] = cosPhi*sinPsi;
22221 rotMatrix[2][0] = -sinPhi;
22223 rotMatrix[0][1] = sinTheta*sinPhi*cosPsi - cosTheta*sinPsi;
22224 rotMatrix[1][1] = sinTheta*sinPhi*sinPsi + cosTheta*cosPsi;
22225 rotMatrix[2][1] = sinTheta*cosPhi;
22227 rotMatrix[0][2] = cosTheta*sinPhi*cosPsi + sinTheta*sinPsi;
22228 rotMatrix[1][2] = cosTheta*sinPhi*sinPsi - sinTheta*cosPsi;
22229 rotMatrix[2][2] = cosTheta*cosPhi;
22237 dx = Coord_i[0] - center[0];
22238 dy = Coord_i[1] - center[1];
22240 dz = Coord_i[2] - center[2];
22246 rotCoord[0] = rotMatrix[0][0]*dx + rotMatrix[0][1]*dy + rotMatrix[0][2]*dz + translation[0];
22247 rotCoord[1] = rotMatrix[1][0]*dx + rotMatrix[1][1]*dy + rotMatrix[1][2]*dz + translation[1];
22248 rotCoord[2] = rotMatrix[2][0]*dx + rotMatrix[2][1]*dy + rotMatrix[2][2]*dz + translation[2];
22251 if (geometry->
GetnDim() == 2)
22252 node[jPoint] =
new CPoint(rotCoord[0], rotCoord[1], jPoint, config);
22253 if (geometry->
GetnDim() == 3)
22254 node[jPoint] =
new CPoint(rotCoord[0], rotCoord[1], rotCoord[2], jPoint, config);
22270 for (iMarker = 0; iMarker < geometry->
GetnMarker(); iMarker++) {
22274 for (iVertex = 0; iVertex < geometry->
GetnElem_Bound(iMarker); iVertex++) {
22295 delete [] CreateMirror;
22300 unsigned long iElem_Bound;
22301 unsigned short iMarker;
22303 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
22304 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
22305 if (newBoundPer[iMarker][iElem_Bound] != NULL)
delete [] newBoundPer[iMarker][iElem_Bound];
22308 if (newBoundPer != NULL)
delete[] newBoundPer;
22310 if (nNewElem_BoundPer != NULL)
delete[] nNewElem_BoundPer;
22315 unsigned short iMarker, iPeriodic, nPeriodic = 0, iMarkerSend, iMarkerReceive;
22316 unsigned long iVertex, Counter_Send = 0, Counter_Receive = 0, iIndex;
22319 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
22324 Counter_Send = 0; Counter_Receive = 0;
22325 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++) {
22327 Counter_Send += geometry->
PeriodicPoint[iPeriodic][0].size();
22329 Counter_Receive += geometry->
PeriodicPoint[iPeriodic][1].size();
22343 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++)
22345 for (iIndex = 0; iIndex < geometry->
PeriodicPoint[iPeriodic][0].size(); iIndex++) {
22353 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++)
22355 for (iIndex = 0; iIndex < geometry->
PeriodicPoint[iPeriodic][1].size(); iIndex++) {
22364 unsigned long iElem, iPoint, iElem_Bound, GhostPoints;
22365 unsigned short iMarker, iNodes, iDim;
22366 unsigned short iMarkerReceive, iPeriodic, nPeriodic = 0;
22367 ofstream output_file;
22368 string Grid_Marker;
22372 cstr =
new char [val_mesh_out_filename.size()+1];
22373 strcpy (cstr, val_mesh_out_filename.c_str());
22376 output_file.precision(15);
22377 output_file.open(cstr, ios::out);
22380 iMarkerReceive =
nMarker - 1;
22385 std::vector<unsigned long> receive_nodes;
22386 std::vector<unsigned long> send_nodes;
22387 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
22388 if (
bound[iMarker][0]->GetVTK_Type() ==
VERTEX) {
22390 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
22391 if (
bound[iMarker][iElem_Bound]->GetRotation_Type() == 1) {
22392 receive_nodes.push_back(
bound[iMarker][iElem_Bound]->GetNode(0));
22394 send_nodes.push_back(
bound[iMarker][iElem_Bound]->GetNode(0));
22404 std::vector<unsigned long> NewSort;
22405 std::vector<unsigned long> ReverseSort;
22406 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
22407 bool isReceive = (find(receive_nodes.begin(), receive_nodes.end(), iPoint)
22408 != receive_nodes.end());
22409 bool isSend = (find(send_nodes.begin(), send_nodes.end(), iPoint)
22410 != send_nodes.end());
22411 if (!isSend && !isReceive) {
22412 NewSort.push_back(iPoint);
22415 NewSort.insert(NewSort.end(), receive_nodes.begin(), receive_nodes.end());
22416 NewSort.insert(NewSort.end(), send_nodes.begin(), send_nodes.end());
22418 ReverseSort.resize(NewSort.size());
22419 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
22420 unsigned long jPoint;
22421 for (jPoint = 0; jPoint <
nPoint; jPoint++) {
22422 if (NewSort[iPoint] == jPoint) {
22423 ReverseSort[jPoint] = iPoint;
22433 output_file <<
"NDIME= " <<
nDim << endl;
22434 output_file <<
"NELEM= " <<
nElem << endl;
22435 for (iElem = 0; iElem <
nElem; iElem++) {
22437 for (iNodes = 0; iNodes <
elem[iElem]->
GetnNodes(); iNodes++)
22438 output_file <<
"\t" << ReverseSort[
elem[iElem]->GetNode(iNodes)];
22439 output_file <<
"\t"<<iElem<< endl;
22442 output_file <<
"NPOIN= " <<
nPoint <<
"\t" <<
nPoint - GhostPoints << endl;
22443 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
22444 for (iDim = 0; iDim <
nDim; iDim++) {
22445 output_file << scientific;
22446 output_file <<
"\t" <<
node[NewSort[iPoint]]->
GetCoord(iDim) ;
22448 output_file <<
"\t" << iPoint << endl;
22451 output_file <<
"NMARK= " <<
nMarker << endl;
22452 for (iMarker = 0; iMarker <
nMarker; iMarker++) {
22453 if (
bound[iMarker][0]->GetVTK_Type() !=
VERTEX) {
22456 output_file <<
"MARKER_TAG= " << Grid_Marker << endl;
22457 output_file <<
"MARKER_ELEMS= " <<
nElem_Bound[iMarker] + nNewElem_BoundPer[iMarker] << endl;
22459 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
22461 for (iNodes = 0; iNodes <
bound[iMarker][iElem_Bound]->
GetnNodes()-1; iNodes++)
22462 output_file << ReverseSort[
bound[iMarker][iElem_Bound]->GetNode(iNodes)] <<
"\t" ;
22464 output_file << ReverseSort[
bound[iMarker][iElem_Bound]->
GetNode(iNodes)] << endl;
22468 if (nNewElem_BoundPer[iMarker] > 0) {
22469 for (iElem_Bound = 0; iElem_Bound < nNewElem_BoundPer[iMarker]; iElem_Bound++) {
22470 output_file << newBoundPer[iMarker][iElem_Bound]->
GetVTK_Type() <<
"\t" ;
22471 for (iNodes = 0; iNodes < newBoundPer[iMarker][iElem_Bound]->
GetnNodes()-1; iNodes++)
22472 output_file << ReverseSort[newBoundPer[iMarker][iElem_Bound]->GetNode(iNodes)] <<
"\t" ;
22473 iNodes = newBoundPer[iMarker][iElem_Bound]->GetnNodes()-1;
22474 output_file << ReverseSort[newBoundPer[iMarker][iElem_Bound]->GetNode(iNodes)] << endl;
22480 if (
bound[iMarker][0]->GetVTK_Type() ==
VERTEX) {
22481 output_file <<
"MARKER_TAG= SEND_RECEIVE" << endl;
22482 output_file <<
"MARKER_ELEMS= " <<
nElem_Bound[iMarker]<< endl;
22486 for (iElem_Bound = 0; iElem_Bound <
nElem_Bound[iMarker]; iElem_Bound++) {
22488 ReverseSort[
bound[iMarker][iElem_Bound]->
GetNode(0)] <<
"\t" <<
22495 for (iMarker = 0; iMarker < config->
GetnMarker_All(); iMarker++)
22499 output_file <<
"NPERIODIC= " << nPeriodic + 1 << endl;
22502 output_file <<
"PERIODIC_INDEX= 0" << endl;
22503 output_file <<
"0.000000000000000e+00" <<
"\t" <<
"0.000000000000000e+00" <<
"\t" <<
"0.000000000000000e+00" << endl;
22504 output_file <<
"0.000000000000000e+00" <<
"\t" <<
"0.000000000000000e+00" <<
"\t" <<
"0.000000000000000e+00" << endl;
22505 output_file <<
"0.000000000000000e+00" <<
"\t" <<
"0.000000000000000e+00" <<
"\t" <<
"0.000000000000000e+00" << endl;
22508 for (iPeriodic = 1; iPeriodic <= nPeriodic; iPeriodic++) {
22509 for (iMarker = 0; iMarker <
nMarker; iMarker++)
22517 output_file <<
"PERIODIC_INDEX= " << iPeriodic << endl;
22518 output_file << center[0] <<
"\t" << center[1] <<
"\t" << center[2] << endl;
22519 output_file << angles[0] <<
"\t" << angles[1] <<
"\t" << angles[2] << endl;
22520 output_file << transl[0] <<
"\t" << transl[1] <<
"\t" << transl[2] << endl;
22525 output_file.close();
22530 unsigned long iElem, iPoint;
22531 unsigned short iDim;
22532 ofstream Tecplot_File;
22534 Tecplot_File.open(mesh_filename, ios::out);
22535 Tecplot_File <<
"TITLE= \"Visualization of the volumetric grid\"" << endl;
22538 Tecplot_File <<
"VARIABLES = \"x\",\"y\" " << endl;
22539 Tecplot_File <<
"ZONE NODES= "<<
nPoint <<
", ELEMENTS= "<<
nElem <<
", DATAPACKING=POINT, ZONETYPE=FEQUADRILATERAL"<< endl;
22542 Tecplot_File <<
"VARIABLES = \"x\",\"y\",\"z\" " << endl;
22543 Tecplot_File <<
"ZONE NODES= "<<
nPoint <<
", ELEMENTS= "<<
nElem <<
", DATAPACKING=POINT, ZONETYPE=FEBRICK"<< endl;
22546 for (iPoint = 0; iPoint <
nPoint; iPoint++) {
22547 for (iDim = 0; iDim <
nDim; iDim++)
22548 Tecplot_File << scientific <<
node[iPoint]->GetCoord(iDim) <<
"\t";
22549 Tecplot_File <<
"\n";
22552 for (iElem = 0; iElem <
nElem; iElem++) {
22584 if (
elem[iElem]->GetVTK_Type() ==
PRISM) {
22593 Tecplot_File.close();
22597 unsigned long iPoint;
22599 nPoint = val_npoint;
22600 Priority =
new short[nPoint];
22601 RightCV =
new bool[nPoint];
22606 for (iPoint = 0; iPoint < nPoint; iPoint ++) {
22607 QueueCV[0].push_back(iPoint);
22608 Priority[iPoint] = 0;
22609 RightCV[iPoint] =
true;
22623 unsigned short Max_Neighbors = QueueCV.size()-1;
22626 if (val_new_point > nPoint) {
22631 if (val_number_neighbors > Max_Neighbors)
22632 QueueCV.resize(val_number_neighbors+1);
22635 bool InQueue =
false;
22636 if (Priority[val_new_point] == val_number_neighbors) InQueue =
true;
22640 QueueCV[val_number_neighbors].push_back(val_new_point);
22641 Priority[val_new_point] = val_number_neighbors;
22647 unsigned short iPoint;
22651 if (val_remove_point > nPoint) {
22656 short Number_Neighbors = Priority[val_remove_point];
22657 if (Number_Neighbors == -1) {
22659 SPRINTF(buf,
"The CV %lu is not in the priority list.", val_remove_point);
22664 vector<unsigned long>::iterator ItQueue = find(QueueCV[Number_Neighbors].begin(),
22665 QueueCV[Number_Neighbors].end(),
22667 if ( ItQueue != QueueCV[Number_Neighbors].end() ) QueueCV[Number_Neighbors].erase(ItQueue);
22669 Priority[val_remove_point] = -1;
22672 unsigned short Size_QueueCV = 0;
22674 for (iPoint = 0; iPoint < QueueCV.size(); iPoint ++)
22675 if (QueueCV[iPoint].size() != 0) { Size_QueueCV = iPoint; check =
true;}
22679 if (check) QueueCV.resize(Size_QueueCV+1);
22680 else QueueCV.resize(1);
22686 if (val_number_neighbors < 0) {
22687 val_number_neighbors = 0;
22688 RightCV[val_move_point] =
false;
22691 RightCV[val_move_point] =
true;
22698 AddCV(val_move_point, val_number_neighbors);
22705 short Number_Neighbors = Priority[val_incr_point];
22706 if (Number_Neighbors == -1) {
22708 SPRINTF(buf,
"The CV %lu is not in the priority list.", val_incr_point);
22716 AddCV(val_incr_point, Number_Neighbors+1);
22723 short Number_Neighbors = Priority[val_red_point];
22724 if (Number_Neighbors == -1) {
22726 SPRINTF(buf,
"The CV %lu is not in the priority list.", val_red_point);
22730 if (Number_Neighbors != 0) {
22736 AddCV(val_red_point, Number_Neighbors-1);
22743 unsigned short iPoint;
22744 unsigned long jPoint;
22747 for (iPoint = 0; iPoint < QueueCV.size(); iPoint ++) {
22748 cout <<
"Number of neighbors " << iPoint <<
": ";
22749 for (jPoint = 0; jPoint < QueueCV[iPoint].size(); jPoint ++) {
22750 cout << QueueCV[iPoint][jPoint] <<
" ";
22758 unsigned long iPoint;
22760 for (iPoint = 0; iPoint < nPoint; iPoint ++)
22761 cout <<
"Control Volume: " << iPoint <<
" Priority: " << Priority[iPoint] << endl;
22766 if (QueueCV.size() != 0)
return QueueCV[QueueCV.size()-1][0];
22771 unsigned short iPoint;
22777 if ( QueueCV.size() == 1 ) {
22778 for (iPoint = 0; iPoint < QueueCV[0].size(); iPoint ++) {
22779 if (RightCV[QueueCV[0][iPoint]]) { check =
false;
break; }
22783 for (iPoint = 1; iPoint < QueueCV.size(); iPoint ++)
22784 if (QueueCV[iPoint].size() != 0) { check =
false;
break;}
22791 unsigned short iPoint;
22795 for (iPoint = 0; iPoint < QueueCV.size(); iPoint ++)
22796 if (QueueCV[iPoint].size() != 0) {
TotalCV += QueueCV[iPoint].size(); }
22802 unsigned short iNode;
22803 unsigned long jPoint;
22806 for (iNode = 0; iNode < fine_grid->
node[iPoint]->
GetnPoint(); iNode ++) {
bool IsEmpty(void) const
Function, which returns whether or not the ADT is empty.
Class for storing an ADT of (linear) elements in an arbitrary number of dimensions.
void DetermineNearestElement(const su2double *coor, su2double &dist, unsigned short &markerID, unsigned long &elemID, int &rankID)
Function, which determines the nearest element in the ADT for the given coordinate.
static void Error(std::string ErrorMsg, std::string FunctionName)
static void Barrier(Comm comm)
static void Probe(int source, int tag, Comm comm, Status *status)
static void Recv(void *buf, int count, Datatype datatype, int dest, int tag, Comm comm, Status *status)
static void Get_count(Status *status, Datatype datatype, int *count)
static void Gather(void *sendbuf, int sendcnt, Datatype sendtype, void *recvbuf, int recvcnt, Datatype recvtype, int root, Comm comm)
static void Isend(void *buf, int count, Datatype datatype, int dest, int tag, Comm comm, Request *request)
static void Allgather(void *sendbuf, int sendcnt, Datatype sendtype, void *recvbuf, int recvcnt, Datatype recvtype, Comm comm)
static void Scatter(void *sendbuf, int sendcnt, Datatype sendtype, void *recvbuf, int recvcnt, Datatype recvtype, int root, Comm comm)
static void Allreduce(void *sendbuf, void *recvbuf, int count, Datatype datatype, Op op, Comm comm)
static void Waitall(int nrequests, Request *request, Status *status)
static void Reduce(void *sendbuf, void *recvbuf, int count, Datatype datatype, Op op, int root, Comm comm)
static void Alltoall(void *sendbuf, int sendcount, Datatype sendtype, void *recvbuf, int recvcount, Datatype recvtype, Comm comm)
static void Comm_size(Comm comm, int *size)
static void Waitany(int nrequests, Request *request, int *index, Status *status)
static void Irecv(void *buf, int count, Datatype datatype, int source, int tag, Comm comm, Request *request)
static void Bcast(void *buf, int count, Datatype datatype, int root, Comm comm)
static void Sendrecv(void *sendbuf, int sendcnt, Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcnt, Datatype recvtype, int source, int recvtag, Comm comm, Status *status)
Main class for defining the problem; basically this class reads the configuration file,...
su2double * GetPeriodicTranslate(unsigned short val_index)
Get the translation vector for a periodic transformation.
string GetMarker_ActDiskInlet_TagBound(unsigned short val_marker)
Get the index of the surface defined in the geometry file.
string GetMarker_ActDiskOutlet_TagBound(unsigned short val_marker)
Get the index of the surface defined in the geometry file.
su2double GetRotation_Rate_Y(unsigned short val_iZone)
Get the angular velocity of the mesh about the y-axis.
void SetnMarker_All(unsigned short val_nmarker)
Stores the number of marker in the simulation.
unsigned short GetMarker_All_GeoEval(unsigned short val_marker)
Get the monitoring information for a marker val_marker.
long GetUnst_AdjointIter(void)
Get the starting direct iteration number for the unsteady adjoint (reverse time integration).
unsigned short GetKind_Solver(void)
Governing equations of the flow (it can be different from the run time equation).
void SetCFL(unsigned short val_mesh, su2double val_cfl)
Get the Courant Friedrich Levi number for each grid.
unsigned short GetMarker_CfgFile_PerBound(string val_marker)
Get the periodic information from the config definition of the marker val_marker.
unsigned short GetnMarker_Shroud(void)
Get number of shroud markers.
unsigned short GetiInst(void)
Get the current instance.
su2double GetWall_HeatFlux(string val_index)
Get the wall heat flux on a constant heat flux boundary.
unsigned long GetnExtIter(void)
Get the number of external iterations.
su2double GetRefSharpEdges(void)
Get the reference coefficient for detecting sharp edges.
void SetMarker_All_TurbomachineryFlag(unsigned short val_marker, unsigned short val_turboflag)
Set a flag to the marker val_marker part of the Turbomachinery (read from the config file).
void SetPeriodicCenter(unsigned short val_index, su2double *center)
Set the rotation center for a periodic transformation.
su2double * GetPeriodicCenter(unsigned short val_index)
Get the rotation center for a periodic transformation.
su2double GetGeo_Waterline_Location(void)
Get the location of the waterline.
unsigned short GetMarker_All_Turbomachinery(unsigned short val_marker)
Get the Turbomachinery information for a marker val_marker.
unsigned short GetnSpanWiseSections(void)
number span-wise sections to compute 3D BC and performance for turbomachinery.
void SetPeriodicTranslate(unsigned short val_index, su2double *translate)
Set the translation vector for a periodic transformation.
string GetMesh_FileName(void)
Get name of the input grid.
unsigned short GetnWingStations(void)
Get the number of sections for computing internal volume.
su2double GetMotion_Origin_X(unsigned short val_iZone)
Get x-coordinate of the mesh motion origin.
unsigned short GetnTimeInstances(void)
Retrieves the number of periodic time instances for Harmonic Balance.
unsigned short GetnMarker_All(void)
Get the total number of boundary markers.
void SetAoA(su2double val_AoA)
Set the angle of attack.
unsigned short GetMarker_CfgFile_GeoEval(string val_marker)
Get the monitoring information from the config definition for the marker val_marker.
bool GetRead_Binary_Restart(void)
Flag for whether binary SU2 native restart files are read.
unsigned short GetMarker_All_DV(unsigned short val_marker)
Get the DV information for a marker val_marker.
void SetMarker_All_Turbomachinery(unsigned short val_marker, unsigned short val_turbo)
Set if a marker val_marker is part of the Turbomachinery (read from the config file).
bool GetDiscard_InFiles(void)
Get information about whether to use fixed CL mode.
su2double * GetPeriodicRotation(unsigned short val_index)
Get the rotation angles for a periodic transformation.
su2double GetTranslation_Rate_X(unsigned short val_iZone)
Get the translational velocity of the mesh in the x-direction.
unsigned short GetnPeriodicIndex(void)
Get the total number of SEND_RECEIVE periodic transformations.
void SetMarker_All_TagBound(unsigned short val_marker, string val_index)
Set the value of the index val_index (read from the geometry file) for the marker val_marker.
unsigned short GetKind_Turb_Model(void)
Get the kind of the turbulence model.
void SetMarker_All_Designing(unsigned short val_marker, unsigned short val_designing)
Set if a marker val_marker is going to be designed val_designing (read from the config file).
su2double GetDelta_UnstTimeND(void)
If we are prforming an unsteady simulation, there is only one value of the time step for the complete...
su2double GetTranslation_Rate_Z(unsigned short val_iZone)
Get the translational velocity of the mesh in the z-direction.
su2double GetAoS(void)
Get the angle of sideslip of the body. It relates to the rotation of the aircraft centerline from the...
void SetPeriodicRotation(unsigned short val_index, su2double *rotation)
Set the rotation angles for a periodic transformation.
unsigned short GetUnsteady_Simulation(void)
Provides information about the time integration, and change the write in the output files information...
unsigned short GetKind_SU2(void)
Get the kind of SU2 software component.
unsigned short GetnMarker_ActDiskInlet(void)
Get the total number of boundary markers.
string GetSolution_AdjFileName(void)
Get the name of the file with the solution of the adjoint flow problem with drag objective function.
unsigned short GetMarker_All_KindBC(unsigned short val_marker)
Get the kind of boundary for each marker.
vector< string > fields
Tags for the different fields in a restart file.
su2double GetCFL(unsigned short val_mesh)
Get the Courant Friedrich Levi number for each grid.
void SetMarker_All_ZoneInterface(unsigned short val_marker, unsigned short val_fsiinterface)
Set if a marker val_marker is part of the FSI interface val_plotting (read from the config file).
unsigned short GetMarker_All_PyCustom(unsigned short val_marker)
Get the Python customization for a marker val_marker.
unsigned short GetMarker_CfgFile_Designing(string val_marker)
Get the monitoring information from the config definition for the marker val_marker.
su2double * GetPeriodicTranslation(string val_marker)
Translation vector for a rotational periodic boundary.
unsigned short GetnSpanMaxAllZones(void)
number span-wise sections to compute performance for turbomachinery.
su2double GetAoA(void)
Get the angle of attack of the body. This is the angle between a reference line on a lifting body (of...
unsigned short GetMarker_CfgFile_TurbomachineryFlag(string val_marker)
Get the TurboPerformance flag information from the config definition for the marker val_marker.
string GetMarker_Shroud(unsigned short val_marker)
Get the marker shroud.
bool GetGrid_Movement(void)
Get information about the grid movement.
void SetMarker_All_Moving(unsigned short val_marker, unsigned short val_moving)
Set if a marker val_marker is going to be moved val_moving (read from the config file).
unsigned short GetMarker_CfgFile_MixingPlaneInterface(string val_marker)
Get the MixingPlane interface information from the config definition for the marker val_marker.
unsigned short GetnMarker_NearFieldBound(void)
Get the total number of boundary markers.
su2double GetSemiSpan(void)
Get the wing semi span.
unsigned short GetKind_Regime(void)
Governing equations of the flow (it can be different from the run time equation).
su2double * GetPeriodicRotCenter(string val_marker)
Center of rotation for a rotational periodic boundary.
void SetAoS(su2double val_AoS)
Set the angle of attack.
void SetMarker_All_PyCustom(unsigned short val_marker, unsigned short val_PyCustom)
Set if a marker val_marker is going to be customized in Python val_PyCustom (read from the config fil...
bool GetActDisk_DoubleSurface(void)
Actuator disk defined with a double surface.
long GetVisualize_CV(void)
Get the node number of the CV to visualize.
unsigned short GetnMarker_ActDiskOutlet(void)
Get the total number of boundary markers.
void SetRefArea(su2double val_area)
In case the RefArea is equal to 0 then, it is necessary to compute a reference area,...
unsigned short GetMarker_CfgFile_DV(string val_marker)
Get the DV information from the config definition for the marker val_marker.
string GetSurfAdjCoeff_FileName(void)
Get the name of the file with the surface information for the adjoint problem.
su2double GetIsothermal_Temperature(string val_index)
Get the wall temperature (static) at an isothermal boundary.
su2double GetOmega_Ref(void)
Get the value of the reference angular velocity for non-dimensionalization.
su2double GetRotation_Rate_Z(unsigned short val_iZone)
Get the angular velocity of the mesh about the z-axis.
short GetMarker_All_SendRecv(unsigned short val_marker)
Get the send-receive information for a marker val_marker.
su2double GetHarmonicBalance_Period(void)
Retrieves the period of oscillations to be used with Harmonic Balance.
unsigned short GetMarker_Periodic_Donor(string val_marker)
Get the rotationally periodic donor marker for boundary val_marker.
unsigned short GetKind_SpanWise(void)
Get the kind of turbomachinery architecture.
void SetMarker_All_Analyze(unsigned short val_marker, unsigned short val_analyze)
Set if a marker val_marker is going to be plot val_plotting (read from the config file).
void SetMarker_All_SendRecv(unsigned short val_marker, short val_index)
Set if a marker val_marker is going to be sent or receive val_index from another domain.
unsigned short GetMarker_All_Plotting(unsigned short val_marker)
Get the plotting information for a marker val_marker.
void SetMarker_All_GeoEval(unsigned short val_marker, unsigned short val_geoeval)
Set if a marker val_marker is going to be monitored val_monitoring (read from the config file).
su2double * GetPeriodicRotAngles(string val_marker)
Angles of rotation for a rotational periodic boundary.
unsigned short GetnMarker_Turbomachinery(void)
number Turbomachinery performance option specified from config file.
su2double GetVelocity_Ref(void)
Get the value of the reference velocity for non-dimensionalization.
unsigned short GetMarker_CfgFile_PyCustom(string val_marker)
Get the Python customization information from the config definition for the marker val_marker.
string GetUnsteady_FileName(string val_filename, int val_iter)
Augment the input filename with the iteration number for an unsteady file.
unsigned short GetMarker_All_Monitoring(unsigned short val_marker)
Get the monitoring information for a marker val_marker.
string GetMarker_All_TagBound(unsigned short val_marker)
Get the index of the surface defined in the geometry file.
void SetAoA_Sens(su2double val_AoA_sens)
Set the angle of attack.
static unsigned short GetnZone(string val_mesh_filename, unsigned short val_format, CConfig *config)
Gets the number of zones in the mesh file.
unsigned short GetnMarker_TurboPerformance(void)
number Turbomachinery performance option specified from config file.
void SetMarker_All_Monitoring(unsigned short val_marker, unsigned short val_monitoring)
Set if a marker val_marker is going to be monitored val_monitoring (read from the config file).
su2double GetNacelleLocation(unsigned short val_index)
Get the defintion of the nacelle location.
unsigned short GetGeo_Description(void)
Get Description of the geometry to be analyzed.
void SetMGLevels(unsigned short val_nMGLevels)
Set the number of multigrid levels.
su2double GetRotation_Rate_X(unsigned short val_iZone)
Get the angular velocity of the mesh about the x-axis.
su2double GetDelta_UnstTime(void)
If we are prforming an unsteady simulation, there is only one value of the time step for the complete...
bool GetWrt_Unsteady(void)
Get information about writing unsteady headers and file extensions.
short GetMarker_All_PerBound(unsigned short val_marker)
Get an internal index that identify the periodic boundary conditions.
su2double GetTranslation_Rate_Y(unsigned short val_iZone)
Get the translational velocity of the mesh in the y-direction.
void SetnSpanWiseSections(unsigned short nSpan)
set number span-wise sections to compute 3D BC and performance for turbomachinery.
bool GetActDisk_SU2_DEF(void)
Actuator disk defined with a double surface.
su2double GetDomainVolume(void)
Get the volume of the whole domain using the fine grid, this value is common for all the grids in the...
unsigned short GetMarker_All_TurbomachineryFlag(unsigned short val_marker)
Get the Turbomachinery flag information for a marker val_marker.
unsigned short GetMarker_CfgFile_KindBC(string val_marker)
Get the boundary information (kind of boundary) in the config information of the marker val_marker.
unsigned short GetMarker_CfgFile_Moving(string val_marker)
Get the motion information from the config definition for the marker val_marker.
unsigned short GetiZone(void)
Provides the number of varaibles.
su2double GetMotion_Origin_Y(unsigned short val_iZone)
Get y-coordinate of the mesh motion origin.
unsigned short GetOutput_FileFormat(void)
Get the format of the output solution.
void SetMarker_All_MixingPlaneInterface(unsigned short val_marker, unsigned short val_mixplan_interface)
Set if a marker val_marker is part of the MixingPlane interface (read from the config file).
su2double GetLength_Ref(void)
Get the value of the reference length for non-dimensionalization. This value should always be 1 inter...
su2double GetStations_Bounds(unsigned short val_var)
Get the value of the limits for the sections.
bool GetAxisymmetric(void)
Get information about the axisymmetric frame.
void SetSemiSpan(su2double val_semispan)
In case the SemiSpan is equal to 0 then, it is necessary to compute the max y distance,...
void SetDomainVolume(su2double val_volume)
Set the value of the domain volume computed on the finest grid.
void SetMarker_All_PerBound(unsigned short val_marker, short val_perbound)
Set if a marker val_marker is going to be periodic val_perbound (read from the config file).
unsigned short GetMesh_FileFormat(void)
Get the format of the input/output grid.
su2double GetRefArea(void)
Get the reference area for non dimensional coefficient computation. If the value from the is 0 then,...
void SetnBlades(unsigned short val_iZone, su2double nblades)
number Turbomachinery blades computed using the pitch information.
string GetObjFunc_Extension(string val_filename)
Append the input filename string with the appropriate objective function extension.
bool GetFrozen_Visc_Disc(void)
Provides information about the way in which the turbulence will be treated by the disc....
unsigned short Get_nSpanWiseSections_User(void)
number span-wise sections to compute 3D BC and performance for turbomachinery specified by the user.
void SetMarker_All_KindBC(unsigned short val_marker, unsigned short val_boundary)
Set the value of the boundary val_boundary (read from the config file) for the marker val_marker.
unsigned short GetMarker_CfgFile_Monitoring(string val_marker)
Get the monitoring information from the config definition for the marker val_marker.
void SetMarker_All_DV(unsigned short val_marker, unsigned short val_DV)
Set if a marker val_marker is going to be affected by design variables val_moving (read from the conf...
su2double GetMotion_Origin_Z(unsigned short val_iZone)
Get z-coordinate of the mesh motion origin.
void SetAoS_Offset(su2double val_AoS_offset)
Set the off set sideslip angle.
void SetnPeriodicIndex(unsigned short val_index)
Set the total number of SEND_RECEIVE periodic transformations.
unsigned short GetMarker_CfgFile_Analyze(string val_marker)
Get the plotting information from the config definition for the marker val_marker.
unsigned short GetMarker_CfgFile_Turbomachinery(string val_marker)
Get the TurboPerformance information from the config definition for the marker val_marker.
void SetAoA_Offset(su2double val_AoA_offset)
Set the off set angle of attack.
void SetMarker_All_Plotting(unsigned short val_marker, unsigned short val_plotting)
Set if a marker val_marker is going to be plot val_plotting (read from the config file).
unsigned short GetnMGLevels(void)
Get the number of multigrid levels.
unsigned short GetnMarker_Max(void)
Get the total number of boundary markers.
string GetMultizone_FileName(string val_filename, int val_iZone)
Append the zone index to the restart or the solution files.
unsigned short GetKind_TurboMachinery(unsigned short val_iZone)
Get the kind of turbomachinery architecture.
unsigned short GetSystemMeasurements(void)
Governing equations of the flow (it can be different from the run time equation).
unsigned short GetMarker_CfgFile_TagBound(string val_marker)
Get the index in the config information of the marker val_marker.
unsigned short GetMarker_CfgFile_Plotting(string val_marker)
Get the plotting information from the config definition for the marker val_marker.
unsigned short GetMarker_CfgFile_ZoneInterface(string val_marker)
Get the FSI interface information from the config definition for the marker val_marker.
void SetFreeStreamTurboNormal(su2double *turboNormal)
Set freestream turbonormal for initializing solution.
unsigned short GetnMarker_InterfaceBound(void)
Get the total number of boundary markers.
Class for defining an edge.
void AddNormal(su2double *val_face_normal)
Add a vector to the normal vector.
void SetNodes_Coord(su2double *val_coord_Edge_CG, su2double *val_coord_FaceElem_CG, su2double *val_coord_Elem_CG)
Set the face that correspond to an edge.
void SetCoord_CG(su2double **val_coord)
Set the center of gravity of the edge.
void GetNormal(su2double *val_normal)
Copy the the normal vector of a face.
su2double GetCG(unsigned short val_dim)
Obtain the centre of gravity of the edge.
su2double GetVolume(su2double *val_coord_Edge_CG, su2double *val_coord_FaceElem_CG, su2double *val_coord_Elem_CG, su2double *val_coord_Point)
Compute Volume associated to each edge.
unsigned long GetNode(unsigned short val_node)
Get the nodes of the edge.
unsigned short GetnNodes(void)
Get the number of nodes of an element.
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
unsigned long Global_nElemDomain
Total number of elements in a simulation across all processors (excluding halos).
unsigned long nelem_edge
Number of edges in the mesh.
unsigned long Global_nelem_triangle
Total number of triangles in the mesh across all processors.
virtual void SetFaces(void)
A virtual member.
su2double *** AverageGridVel
Average boundary normal at each span wise section for each marker.
void ComputeAirfoil_Section(su2double *Plane_P0, su2double *Plane_Normal, su2double MinXCoord, su2double MaxXCoord, su2double MinYCoord, su2double MaxYCoord, su2double MinZCoord, su2double MaxZCoord, su2double *FlowVariable, vector< su2double > &Xcoord_Airfoil, vector< su2double > &Ycoord_Airfoil, vector< su2double > &Zcoord_Airfoil, vector< su2double > &Variable_Airfoil, bool original_surface, CConfig *config)
A virtual member.
vector< su2double > XCoordList
Vector containing points appearing on a single plane.
virtual void SetCustomBoundary(CConfig *config)
Set the data containers for customized boundary conditions.
long FindEdge(unsigned long first_point, unsigned long second_point)
Get the edge index from using the nodes of the edge.
virtual void SetMultiGridWallHeatFlux(CGeometry *geometry, unsigned short val_marker)
A virtual member.
void UpdateGeometry(CGeometry **geometry_container, CConfig *config)
Update the multi-grid structure and the wall-distance.
unsigned short nTurboPerf
Number of Span wise section for each turbo marker, indexed by marker. Needed for deallocation.
unsigned long * nNewElem_Bound
Number of new periodic elements of the boundary.
CEdge ** edge
Edge vector (dual grid information).
unsigned long Global_nelem_quad
Total number of quadrangles in the mesh across all processors.
unsigned long Global_nelem_tetra
Total number of tetrahedra in the mesh across all processors.
su2double ** SpanArea
Average tangential rotational speed at each span wise section for each marker.
virtual unsigned long GetGlobal_nPointDomain()
A virtual member.
unsigned long nElem
Number of elements of the mesh.
unsigned long nelem_quad
Number of quadrangles in the mesh.
unsigned long nEdge
Number of edges of the mesh.
su2double ** MinAngularCoord
Max angular pitch at each span wise section for each marker.
void ComputeSurf_Curvature(CConfig *config)
Find and store all vertices on a sharp corner in the geometry.
virtual void SetControlVolume(CConfig *config, unsigned short action)
A virtual member.
unsigned long nelem_prism
Number of prisms in the mesh.
bool SegmentIntersectsTriangle(su2double point0[3], su2double point1[3], su2double vert0[3], su2double vert1[3], su2double vert2[3])
Segment Intersects Triangle.
unsigned short GetnDim(void)
Get number of coordinates.
unsigned long * nElem_Bound
Number of elements of the boundary.
void RegisterCoordinates(CConfig *config)
Register the coordinates of the mesh nodes.
su2double ** MinRelAngularCoord
Max angular pitch at each span wise section for each marker.
su2double GetCustomBoundaryTemperature(unsigned short val_marker, unsigned long val_vertex)
Get the value of the customized temperature at a specified vertex on a specified marker.
unsigned long nPointDomain
Number of real points of the mesh.
CPrimalGrid *** bound
Boundary vector (primal grid information).
unsigned long ** nTotVertexSpan
number of vertexes for span wise section for each marker.
unsigned short GetnMarker(void)
Get number of markers.
su2double ** CustomBoundaryHeatFlux
unsigned long nelem_edge_bound
Number of edges on the mesh boundaries.
su2double ** SpanWiseValue
Span wise values for each turbo marker.
void SetSpline(vector< su2double > &x, vector< su2double > &y, unsigned long n, su2double yp1, su2double ypn, vector< su2double > &y2)
Given arrays x[1..n] and y[1..n] containing a tabulated function, i.e., yi = f(xi),...
unsigned long Global_nelem_prism
Total number of prisms in the mesh across all processors.
unsigned long GetnElem(void)
Get number of elements.
unsigned long GetnElem_Bound(unsigned short val_marker)
Get the number of boundary elements.
unsigned long nelem_quad_bound
Number of quads on the mesh boundaries.
CTurboVertex **** turbovertex
Boundary Vertex vector ordered for turbomachinery calculation(dual grid information).
unsigned long GetnPointDomain(void)
Get number of real points (that belong to the domain).
CPrimalGrid *** newBound
Boundary vector for new periodic elements (primal grid information).
su2double ** TurboRadius
Min relative angular coord at each span wise section for each marker.
virtual unsigned long GetGlobal_nElemDomain()
A virtual member.
unsigned long Global_nElem
Total number of elements in a simulation across all processors (all types).
unsigned long GetnVertex(unsigned short val_marker)
Get number of vertices.
su2double ** CustomBoundaryTemperature
virtual void SetCoord(CGeometry *geometry)
A virtual member.
virtual void Set_MPI_GridVel(CConfig *config)
A virtual member.
unsigned short * nSpanWiseSections
Number of Span wise section for each turbo marker, indexed by inflow/outflow.
short * Marker_All_SendRecv
virtual unsigned long GetGlobal_nElem()
A virtual member.
unsigned long * npoint_procs
void UpdateCustomBoundaryConditions(CGeometry **geometry_container, CConfig *config)
Update the multi-grid structure for the customized boundary conditions.
string GetMarker_Tag(unsigned short val_marker)
Get the index of a marker.
vector< vector< unsigned long > > Plane_points
Vector containing points appearing on a single plane.
unsigned long * starting_node
virtual void Set_MPI_Coord(CConfig *config)
A virtual member.
vector< unsigned long > PeriodicElem[MAX_NUMBER_PERIODIC]
PeriodicElem[Periodic bc] and return the elements that must be sent.
CVertex *** vertex
Boundary Vertex vector (dual grid information).
unsigned long Global_nPointDomain
Total number of nodes in a simulation across all processors (excluding halos).
virtual void SetMaxLength(CConfig *config)
A virtual member.
vector< vector< su2double > > Zcoord_plane
Vector containing z coordinates of new points appearing on a single plane.
su2double ** TurboRadiusIn
Area at each span wise section for each turbomachinery marker.
void TestGeometry(void)
Create a file for testing the geometry.
unsigned short nMarker
Number of different markers of the mesh.
unsigned long nelem_triangle
Number of triangles in the mesh.
virtual void SetCoord_CG(void)
A virtual member.
unsigned long nPoint
Number of points of the mesh.
unsigned long * nPoint_Linear
su2double GetCustomBoundaryHeatFlux(unsigned short val_marker, unsigned long val_vertex)
Get the value of the customized normal heat flux at a specified vertex on a specified marker.
virtual void SetVertex(void)
A virtual member.
vector< vector< su2double > > FaceArea_plane
Vector containing area/volume associated with new points appearing on a single plane.
map< unsigned long, unsigned long > Global_to_Local_Elem
unsigned long nelem_hexa
Number of hexahedra in the mesh.
bool RayIntersectsTriangle(su2double orig[3], su2double dir[3], su2double vert0[3], su2double vert1[3], su2double vert2[3], su2double *intersect)
Ray Intersects Triangle (Moller and Trumbore algorithm)
unsigned short nDim
Number of dimension of the problem.
virtual void ComputeWall_Distance(CConfig *config)
A virtual member.
void RegisterOutput_Coordinates(CConfig *config)
Register the coordinates of the mesh nodes as output.
unsigned long * ending_node
unsigned short * nSpanSectionsByMarker
vector< vector< su2double > > Ycoord_plane
Vector containing y coordinates of new points appearing on a single plane.
unsigned short GetnZone(void)
Get number of zones.
string * Tag_to_Marker
If you know the index of the boundary (depend of the grid definition), it gives you the maker (where ...
virtual ~CGeometry(void)
Destructor of the class.
unsigned long GetnPoint(void)
Get number of points.
su2double ** SpanAreaIn
Average tangential rotational speed at each span wise section for each turbomachinery marker.
vector< unsigned long > PeriodicPoint[MAX_NUMBER_PERIODIC][2]
PeriodicPoint[Periodic bc] and return the point that must be sent [0], and the image point in the per...
unsigned long adjacency_size
unsigned long nelem_tetra
Number of tetrahedra in the mesh.
unsigned long nPointNode
Size of the node array allocated to hold CPoint objects.
virtual unsigned long GetGlobal_nPoint()
A virtual member.
vector< vector< su2double > > Xcoord_plane
Vector containing x coordinates of new points appearing on a single plane.
bool SegmentIntersectsPlane(su2double *Segment_P0, su2double *Segment_P1, su2double Variable_P0, su2double Variable_P1, su2double *Plane_P0, su2double *Plane_Normal, su2double *Intersection, su2double &Variable_Interp)
Compute the intersection between a segment and a plane.
unsigned long Global_nelem_edge
Total number of edges in the mesh across all processors.
su2double *** AverageTurboNormal
max number of vertexes for each span section for each marker flag.
su2double ** TangGridVelOut
CGeometry(void)
Constructor of the class.
CPrimalGrid ** face
Face vector (primal grid information).
unsigned long nelem_triangle_bound
Number of triangles on the mesh boundaries.
unsigned long Global_nPoint
Total number of nodes in a simulation across all processors (including halos).
void SetnVertexSpanMax(unsigned short marker_flag, unsigned long nVertMax)
Get number of vertices.
su2double ** AverageTangGridVel
Average boundary grid velocity at each span wise section for each marker.
unsigned long nelem_pyramid
Number of pyramids in the mesh.
su2double Point2Plane_Distance(su2double *Coord, su2double *iCoord, su2double *jCoord, su2double *kCoord)
Get the distance between a plane (defined by three point) and a point.
su2double *** AverageNormal
Average boundary normal at each span wise section for each marker in the turbomachinery frame of refe...
su2double GetSpline(vector< su2double > &xa, vector< su2double > &ya, vector< su2double > &y2a, unsigned long n, su2double x)
Given the arrays xa[1..n] and ya[1..n], which tabulate a function (with the xai’s in order),...
su2double ** MaxAngularCoord
Area at each span wise section for each marker.
virtual void SetMultiGridWallTemperature(CGeometry *geometry, unsigned short val_marker)
A virtual member.
virtual void SetBoundControlVolume(CConfig *config, unsigned short action)
A virtual member.
CPrimalGrid ** elem
Element vector (primal grid information).
unsigned long Max_GlobalPoint
Greater global point in the domain local structure.
CPoint ** node
Node vector (dual grid information).
unsigned long Global_nelem_pyramid
Total number of pyramids in the mesh across all processors.
unsigned long * nVertex
Number of vertex for each marker.
unsigned long nFace
Number of faces of the mesh.
su2double ** TangGridVelIn
Radius at each span wise section for each marker.
su2double ** TurboRadiusOut
bool CheckEdge(unsigned long first_point, unsigned long second_point)
Get the edge index from using the nodes of the edge.
unsigned long Global_nelem_hexa
Total number of hexahedra in the mesh across all processors.
unsigned short nZone
Number of zones in the problem.
void SetEdges(void)
A virtual member.
bool SegmentIntersectsLine(su2double point0[2], su2double point1[2], su2double vert0[2], su2double vert1[2])
Segment Intersects Line (for 2D FFD Intersection)
Class for hexahedron element definition.
Class for line element definition.
void SetRestricted_GridVelocity(CGeometry *fine_mesh, CConfig *config)
Set the grid velocity at each node in the coarse mesh level based on a restriction from a finer mesh.
void SetGridVelocity(CConfig *config, unsigned long iter)
Set the grid velocity at each node in the coarse mesh level.
void SetControlVolume(CConfig *config, CGeometry *geometry, unsigned short action)
Set the edge structure of the agglomerated control volume.
CMultiGridGeometry(CGeometry ****geometry, CConfig **config_container, unsigned short iMesh, unsigned short iZone, unsigned short iInst)
Constructor of the class.
void FindNormal_Neighbor(CConfig *config)
Find and store the closest neighbor to a vertex.
void SetMultiGridWallHeatFlux(CGeometry *geometry, unsigned short val_marker)
Set a representative wall normal heat flux of the agglomerated control volume on a particular boundar...
void SetRotationalVelocity(CConfig *config, unsigned short val_iZone, bool print)
Set the rotational velocity at each grid point on a coarse mesh.
void SetTranslationalVelocity(CConfig *config, unsigned short val_iZone, bool print)
Set the translational velocity at each grid point on a coarse mesh.
bool GeometricalCheck(unsigned long iPoint, CGeometry *fine_grid, CConfig *config)
Determine if a can be agglomerated using geometrical criteria.
void SetCoord(CGeometry *geometry)
Set a representative coordinates of the agglomerated control volume.
void SetBoundControlVolume(CConfig *config, CGeometry *geometry, unsigned short action)
Set boundary vertex structure of the agglomerated control volume.
void SetShroudVelocity(CConfig *config)
Set the rotational velocity of the points on the shroud markers to 0.0.
bool SetBoundAgglomeration(unsigned long CVPoint, short marker_seed, CGeometry *fine_grid, CConfig *config)
Determine if a CVPoint van be agglomerated, if it have the same marker point as the seed.
~CMultiGridGeometry(void)
Destructor of the class.
void SetGeometryPlanes(CConfig *config)
Indentify geometrical planes in the mesh.
void SetSuitableNeighbors(vector< unsigned long > *Suitable_Indirect_Neighbors, unsigned long iPoint, unsigned long Index_CoarseCV, CGeometry *fine_grid)
Determine if a CVPoint van be agglomerated, if it have the same marker point as the seed.
void MatchActuator_Disk(CConfig *config)
Mach the near field boundary condition.
void SetMultiGridWallTemperature(CGeometry *geometry, unsigned short val_marker)
Set a representative wall temperature of the agglomerated control volume on a particular boundary mar...
void MatchInterface(CConfig *config)
Mach the interface boundary condition.
void MatchNearField(CConfig *config)
Mach the near field boundary condition.
void SetPoint_Connectivity(void)
Function declaration to avoid partially overridden classes.
Class for a multigrid queue system.
void VisualizeQueue(void)
Visualize the control volume queue.
unsigned long TotalCV(void)
Total number of control volume in the queue.
void RemoveCV(unsigned long val_remove_point)
Remove a CV from the list.
bool EmptyQueue(void)
Check if the queue is empty.
~CMultiGridQueue(void)
Destructor of the class.
void VisualizePriority(void)
Visualize the priority list.
void MoveCV(unsigned long val_move_point, short val_number_neighbors)
Change a CV from a list to a different list.
void RedPriorityCV(unsigned long val_red_point)
Increase the priority of the CV.
void AddCV(unsigned long val_new_point, unsigned short val_number_neighbors)
Add a new CV to the list.
CMultiGridQueue(unsigned long val_npoint)
Constructor of the class.
void IncrPriorityCV(unsigned long val_incr_point)
Increase the priority of the CV.
long NextCV(void)
Find a new seed control volume.
void Update(unsigned long val_update_point, CGeometry *fine_grid)
Update the queue with the new control volume (remove the CV and increase the priority of the neighbor...
void SetPeriodicBoundary(CGeometry *geometry, CConfig *config)
Set the periodic boundaries of the grid.
void SetMeshFile(CGeometry *geometry, CConfig *config, string val_mesh_out_filename)
Write the .su2 file.
void SetTecPlot(char config_filename[MAX_STRING_SIZE], bool new_file)
Set the Tecplot file.
~CPeriodicGeometry(void)
Destructor of the class.
CPeriodicGeometry(CGeometry *geometry, CConfig *config)
Constructor of the class.
void SetColorGrid(CConfig *config)
Set the domains for grid grid partitioning using METIS.
void SetSensitivity(CConfig *config)
Read the sensitivity from adjoint solution file and store it.
void SetBoundTecPlot(char mesh_filename[MAX_STRING_SIZE], bool new_file, CConfig *config)
Set the output file for boundaries in Tecplot.
void SetPoint_Connectivity(void)
Set points which surround a point.
su2double Compute_Dihedral(su2double *LeadingEdge_im1, su2double *TrailingEdge_im1, su2double *LeadingEdge_i, su2double *TrailingEdge_i)
Compute the dihedral of a wing.
void InitiateComms(void *bufSend, int *nElemSend, SU2_MPI::Request *sendReq, void *bufRecv, int *nElemRecv, SU2_MPI::Request *recvReq, unsigned short countPerElem, unsigned short commType)
Routine to launch non-blocking sends and recvs amongst all processors.
void SetBoundaries(CConfig *config)
Set the send receive boundaries of the grid.
void DistributePoints(CConfig *config, CGeometry *geometry)
Distribute the grid points, including ghost points, across all ranks based on a ParMETIS coloring.
~CPhysicalGeometry(void)
Destructor of the class.
void SetElement_Connectivity(void)
Set elements which surround an element.
void SetBoundControlVolume(CConfig *config, unsigned short action)
Set boundary vertex structure of the control volume.
su2double Compute_MaxThickness(su2double *Plane_P0, su2double *Plane_Normal, CConfig *config, vector< su2double > &Xcoord_Airfoil, vector< su2double > &Ycoord_Airfoil, vector< su2double > &Zcoord_Airfoil)
Compute the maximum thickness of an airfoil.
void SetCoord_Smoothing(unsigned short val_nSmooth, su2double val_smooth_coeff, CConfig *config)
Do an implicit smoothing of the grid coordinates.
void GatherInOutAverageValues(CConfig *config, bool allocate)
Set turbo boundary vertex.
su2double Compute_Length(su2double *Plane_P0, su2double *Plane_Normal, CConfig *config, vector< su2double > &Xcoord_Airfoil, vector< su2double > &Ycoord_Airfoil, vector< su2double > &Zcoord_Airfoil)
Compute the length of an airfoil.
void SetMaxLength(CConfig *config)
Set the maximum cell-center to cell-center distance for CVs.
void Compute_Nacelle(CConfig *config, bool original_surface, su2double &Nacelle_Volume, su2double &Nacelle_MinMaxThickness, su2double &Nacelle_MaxMaxThickness, su2double &Nacelle_MinChord, su2double &Nacelle_MaxChord, su2double &Nacelle_MinLERadius, su2double &Nacelle_MaxLERadius, su2double &Nacelle_MinToC, su2double &Nacelle_MaxToC, su2double &Nacelle_ObjFun_MinToC, su2double &Nacelle_MaxTwist)
Evaluate geometrical parameters of a wing.
void SetBoundVolume(void)
Set the volume element associated to each boundary element.
su2double Compute_Area(su2double *Plane_P0, su2double *Plane_Normal, CConfig *config, vector< su2double > &Xcoord_Airfoil, vector< su2double > &Ycoord_Airfoil, vector< su2double > &Zcoord_Airfoil)
Compute the area of an airfoil.
su2double Compute_LERadius(su2double *Plane_P0, su2double *Plane_Normal, vector< su2double > &Xcoord_Airfoil, vector< su2double > &Ycoord_Airfoil, vector< su2double > &Zcoord_Airfoil)
Compute the chord of an airfoil.
void Compute_Wing_LeadingTrailing(su2double *LeadingEdge, su2double *TrailingEdge, su2double *Plane_P0, su2double *Plane_Normal, vector< su2double > &Xcoord_Airfoil, vector< su2double > &Ycoord_Airfoil, vector< su2double > &Zcoord_Airfoil)
Compute the leading/trailing edge location of an airfoil.
void SetSendReceive(CConfig *config)
Set the send receive boundaries of the grid.
su2double Compute_Width(su2double *Plane_P0, su2double *Plane_Normal, vector< su2double > &Xcoord_Airfoil, vector< su2double > &Ycoord_Airfoil, vector< su2double > &Zcoord_Airfoil)
Compute the chord of an airfoil.
void SetMeshFile(CConfig *config, string val_mesh_out_filename)
Write the .su2 file.
unsigned long GetGlobal_nPointDomain()
Retrieve total number of nodes in a simulation across all processors (excluding halos).
void SetTurboVertex(CConfig *config, unsigned short val_iZone, unsigned short marker_flag, bool allocate)
Set turbo boundary vertex.
void DistributeMarkerTags(CConfig *config, CGeometry *geometry)
Broadcast the marker tags for all boundaries from the master rank to all other ranks.
void Set_MPI_MaxLength(CConfig *config)
Perform the MPI communication for the max grid spacing.
su2double Compute_Thickness(su2double *Plane_P0, su2double *Plane_Normal, su2double Location, CConfig *config, vector< su2double > &Xcoord_Airfoil, vector< su2double > &Ycoord_Airfoil, vector< su2double > &Zcoord_Airfoil, su2double &ZLoc)
Compute the thickness of an airfoil.
void SetGeometryPlanes(CConfig *config)
Indentify geometrical planes in the mesh.
void SetRCM_Ordering(CConfig *config)
Set a renumbering using a Reverse Cuthill-McKee Algorithm.
void Check_BoundElem_Orientation(CConfig *config)
Check the volume element orientation.
void Read_CGNS_Format_Parallel_FEM(CConfig *config, string val_mesh_filename, unsigned short val_iZone, unsigned short val_nZone)
Reads for the FEM solver the geometry of the grid and adjust the boundary conditions with the configu...
void ComputeWall_Distance(CConfig *config)
Computes the distance to the nearest no-slip wall for each grid node.
void Compute_Fuselage(CConfig *config, bool original_surface, su2double &Fuselage_Volume, su2double &Fuselage_WettedArea, su2double &Fuselage_MinWidth, su2double &Fuselage_MaxWidth, su2double &Fuselage_MinWaterLineWidth, su2double &Fuselage_MaxWaterLineWidth, su2double &Fuselage_MinHeight, su2double &Fuselage_MaxHeight, su2double &Fuselage_MaxCurvature)
Evaluate geometrical parameters of a wing.
void Check_Periodicity(CConfig *config)
Check the mesh for periodicity and deactivate multigrid if periodicity is found.
void DistributeColoring(CConfig *config, CGeometry *geometry)
Distributes the coloring from ParMETIS so that each rank has complete information about the local gri...
su2double Compute_Height(su2double *Plane_P0, su2double *Plane_Normal, vector< su2double > &Xcoord_Airfoil, vector< su2double > &Ycoord_Airfoil, vector< su2double > &Zcoord_Airfoil)
Compute the chord of an airfoil.
void CompleteComms(int nSends, SU2_MPI::Request *sendReq, int nRecvs, SU2_MPI::Request *recvReq)
Routine to complete the set of non-blocking communications launched with InitiateComms() with MPI_Wai...
void SetPositive_ZArea(CConfig *config)
Compute surface area (positive z-direction) for force coefficient non-dimensionalization.
void DistributeVolumeConnectivity(CConfig *config, CGeometry *geometry, unsigned short Elem_Type)
Distribute the connectivity for a single volume element type across all ranks based on a ParMETIS col...
void LoadVolumeElements(CConfig *config, CGeometry *geometry)
Load the local volume elements after partitioning (owned and ghost) into the geometry class objects.
void SetGridVelocity(CConfig *config, unsigned long iter)
Set the grid velocity via finite differencing at each node.
void Compute_Fuselage_LeadingTrailing(su2double *LeadingEdge, su2double *TrailingEdge, su2double *Plane_P0, su2double *Plane_Normal, vector< su2double > &Xcoord_Airfoil, vector< su2double > &Ycoord_Airfoil, vector< su2double > &Zcoord_Airfoil)
Compute the leading/trailing edge location of a fuselage.
void MatchZone(CConfig *config, CGeometry *geometry_donor, CConfig *config_donor, unsigned short val_iZone, unsigned short val_nZone)
Mach the interface boundary condition.
void SetShroudVelocity(CConfig *config)
Set the rotational velocity of the points on the shroud markers to 0.
void SetControlVolume(CConfig *config, unsigned short action)
Set the edge structure of the control volume.
void Read_SU2_Format_Parallel_FEM(CConfig *config, string val_mesh_filename, unsigned short val_iZone, unsigned short val_nZone)
Reads for the FEM solver the geometry of the grid and adjust the boundary conditions with the configu...
void Set_MPI_Coord(CConfig *config)
Perform the MPI communication for the grid coordinates (dynamic meshes).
void SetRotationalVelocity(CConfig *config, unsigned short val_iZone, bool print)
Set the rotational velocity at each node.
void ComputeNSpan(CConfig *config, unsigned short val_iZone, unsigned short marker_flag, bool allocate)
Set number of span wise level for turbomachinery computation.
void SetAvgTurboValue(CConfig *config, unsigned short val_iZone, unsigned short marker_flag, bool allocate)
Set turbo boundary vertex.
void GetQualityStatistics(su2double *statistics)
Compute some parameters about the grid quality.
void SetColorGrid_Parallel(CConfig *config)
Set the domains for grid grid partitioning using ParMETIS.
su2double Compute_Curvature(su2double *LeadingEdge_im1, su2double *TrailingEdge_im1, su2double *LeadingEdge_i, su2double *TrailingEdge_i, su2double *LeadingEdge_ip1, su2double *TrailingEdge_ip1)
Compute the curvature of a wing.
void Set_MPI_OldCoord(CConfig *config)
Perform the MPI communication for the grid coordinates (dynamic meshes) for restart purposes.
void MatchNearField(CConfig *config)
Mach the near field boundary condition.
void Set_MPI_GridVel(CConfig *config)
Perform the MPI communication for the grid velocities.
void DistributeSurfaceConnectivity(CConfig *config, CGeometry *geometry, unsigned short Elem_Type)
Distribute the connectivity for a single surface element type in all markers across all ranks based o...
void SetTranslationalVelocity(CConfig *config, unsigned short val_iZone, bool print)
Set the translational velocity at each node.
void MatchInterface(CConfig *config)
Mach the interface boundary condition.
void PartitionSurfaceConnectivity(CConfig *config, CGeometry *geometry, unsigned short Elem_Type)
Partition the marker connectivity held on the master rank according to a linear partitioning.
void SetBoundSensitivity(CConfig *config)
Read the sensitivity from an input file.
void Compute_Wing(CConfig *config, bool original_surface, su2double &Wing_Volume, su2double &Wing_MinMaxThickness, su2double &Wing_MaxMaxThickness, su2double &Wing_MinChord, su2double &Wing_MaxChord, su2double &Wing_MinLERadius, su2double &Wing_MaxLERadius, su2double &Wing_MinToC, su2double &Wing_MaxToC, su2double &Wing_ObjFun_MinToC, su2double &Wing_MaxTwist, su2double &Wing_MaxCurvature, su2double &Wing_MaxDihedral)
Evaluate geometrical parameters of a wing.
void VisualizeControlVolume(CConfig *config, unsigned short action)
Visualize the structure of the control volume(s).
long GetGlobal_to_Local_Point(unsigned long val_ipoint)
Get the local index that correspond with the global numbering index.
CPhysicalGeometry(void)
Constructor of the class.
void MatchActuator_Disk(CConfig *config)
Mach the near field boundary condition.
su2double Compute_Twist(su2double *Plane_P0, su2double *Plane_Normal, vector< su2double > &Xcoord_Airfoil, vector< su2double > &Ycoord_Airfoil, vector< su2double > &Zcoord_Airfoil)
Compute the twist of an airfoil.
void Read_SU2_Format_Parallel(CConfig *config, string val_mesh_filename, unsigned short val_iZone, unsigned short val_nZone)
Reads the geometry of the grid and adjust the boundary conditions with the configuration file in para...
void SetTecPlot(char config_filename[MAX_STRING_SIZE], bool new_file)
Set the Tecplot file.
void FindNormal_Neighbor(CConfig *config)
Find and store the closest neighbor to a vertex.
void Read_CGNS_Format_Parallel(CConfig *config, string val_mesh_filename, unsigned short val_iZone, unsigned short val_nZone)
Reads the geometry of the grid and adjust the boundary conditions with the configuration file in para...
void LoadSurfaceElements(CConfig *config, CGeometry *geometry)
Load the local surface elements after partitioning (owned and ghost) into the geometry class objects.
void SetCoord_CG(void)
Set the center of gravity of the face, elements and edges.
void LoadPoints(CConfig *config, CGeometry *geometry)
Load the local grid points after partitioning (owned and ghost) into the geometry class objects.
void SetBoundSensitivityTranspiration(CConfig *config)
Read the transpiration sensitivity from an input file.
void UpdateTurboVertex(CConfig *config, unsigned short val_iZone, unsigned short marker_flag)
update turbo boundary vertex.
void SetPeriodicBoundary(CConfig *config)
Set the periodic boundary conditions.
su2double Compute_Chord(su2double *Plane_P0, su2double *Plane_Normal, vector< su2double > &Xcoord_Airfoil, vector< su2double > &Ycoord_Airfoil, vector< su2double > &Zcoord_Airfoil)
Compute the chord of an airfoil.
bool FindFace(unsigned long first_elem, unsigned long second_elem, unsigned short &face_first_elem, unsigned short &face_second_elem)
Find repeated nodes between two elements to identify the common face.
void Check_IntElem_Orientation(CConfig *config)
Check the volume element orientation.
su2double Compute_WaterLineWidth(su2double *Plane_P0, su2double *Plane_Normal, CConfig *config, vector< su2double > &Xcoord_Airfoil, vector< su2double > &Ycoord_Airfoil, vector< su2double > &Zcoord_Airfoil)
Compute the chord of an airfoil.
Class for point definition (including control volume definition).
void SetCurvature(su2double val_curvature)
Set the value of the curvature at a surface node.
void SetGridVel(unsigned short val_dim, su2double val_gridvel)
Set the value of the grid velocity at the point.
void SetPhysicalBoundary(bool val_boundary)
Set if a point belong to the boundary.
void SetAgglomerate_Indirect(bool val_agglomerate)
Set information about if the indirect neighbors can be agglomerated.
su2double * GetCoord_Sum(void)
Get the value of the summed coordinates for implicit smoothing.
bool GetDomain(void)
For parallel computation, its indicates if a point must be computed or not.
unsigned long GetParent_CV(void)
Get the parent control volume of an agglomerated control volume.
void SetParent_CV(unsigned long val_parent_CV)
Set the parent control volume of an agglomerated control volume.
void SetCoord_n1(void)
Set the coordinates of the control volume at time n-1.
void SetnChildren_CV(unsigned short val_nchildren_CV)
Set the number of children of an agglomerated control volume.
su2double GetVolume(void)
Get area or volume of the control volume.
void SetEdge(long val_edge, unsigned short val_nEdge)
Set the edges that compose the control volume.
void AddVolume(su2double val_Volume)
Adds some area or volume of the CV.
void SetSolidBoundary(bool val_boundary)
Set if a point belong to the boundary.
void SetSharpEdge_Distance(su2double val_distance)
Set the value of the distance to a sharp edge.
void ResetBoundary(void)
Reset the boundary of a control volume.
void ResetElem(void)
Reset the elements of a control volume.
su2double * GetGridVel(void)
Get the value of the grid velocity at the point.
void SetCoord(unsigned short val_dim, su2double val_coord)
Set the coordinates for the control volume.
void SetWall_Distance(su2double val_distance)
Set the value of the distance to the nearest wall.
unsigned short GetnNeighbor(void)
Get the number of neighbor of a point.
su2double GetMaxLength(void)
Get the maximum cell-center to cell-center length.
bool GetAgglomerate(void)
Get information about if a control volume has been agglomerated.
unsigned long GetChildren_CV(unsigned short val_nchildren_CV)
Get the children control volume of an agglomerated control volume.
su2double * GetCoord_Old(void)
Get the value of the old coordinates for implicit smoothing.
su2double * GetCoord_n(void)
Get the coordinates of the control volume at time n.
void SetBoundary(unsigned short val_nmarker)
Set if a point belong to the boundary.
void SetPoint(unsigned long val_point)
Set the points that compose the control volume.
bool GetBoundary(void)
Provides information about if a point belong to the boundaries.
unsigned short GetColor(void)
Get the color of a point, the color indicates to which subdomain the point belong to.
su2double GetCoord(unsigned short val_dim)
Get the coordinates dor the control volume.
void SetVertex(long val_vertex, unsigned short val_nMarker)
Set the boundary vertex that compose the control volume.
unsigned short GetnChildren_CV(void)
Get the number of children of an agglomerated control volume.
void SetMaxLength(su2double val_max_length)
Set the max cell-center to cell-center length.
unsigned long GetElem(unsigned short val_elem)
Get all the elements that compose the control volume.
unsigned long GetPoint(unsigned short val_point)
Get all the points that compose the control volume.
void SetVolume(su2double val_Volume)
Set the volume of the control volume.
void SetChildren_CV(unsigned short val_nchildren_CV, unsigned long val_children_CV)
Set the children control volumes of an agglomerated control volume.
void SetColor(unsigned short val_color)
Set a color to the point that comes from the grid partitioning.
long GetEdge(unsigned short val_edge)
Get all the edges that compose the control volume.
void SetFlip_Orientation(void)
Set the coordinates for the control volume.
unsigned long GetGlobalIndex(void)
Get the global index in a parallel computation.
su2double * GetCoord_n1(void)
Get the coordinates of the control volume at time n-1.
void SetElem(unsigned long val_elem)
Set the elements that set the control volume.
void SetCoord_n(void)
Set the coordinates of the control volume at time n.
long GetVertex(unsigned short val_marker)
Get the vertex that compose the control volume for a marker.
void AddCoord_Sum(su2double *val_coord_sum)
Add the value of the coordinates to the Coord_Sum vector for implicit smoothing.
unsigned short GetnPoint(void)
Get the number of points that compose the control volume.
void ResetPoint(void)
Reset the points that compose the control volume.
void SetCoord_Old(su2double *val_coord_old)
Set the value of the vector Coord_Old for implicit smoothing.
unsigned short GetnElem(void)
Get the number of elements that compose the control volume.
void SetGlobalIndex(unsigned long val_globalindex)
Set the global index in a parallel computation.
bool GetAgglomerate_Indirect(void)
Get information about if the indirect neighbors can be agglomerated.
void SetDomain(bool val_domain)
For parallel computation, its indicates if a point must be computed or not.
Class to define the numerical primal grid.
virtual unsigned short GetnFaces(void)=0
A pure virtual member.
virtual unsigned short GetnNodes(void)=0
A pure virtual member.
su2double GetCG(unsigned short val_dim)
Get the center of gravity of an element (including edges).
virtual void SetRotation_Type(unsigned short val_rotation_type)
A pure virtual member.
su2double GetFaceCG(unsigned short val_face, unsigned short val_dim)
Get the CG of a face of an element.
virtual unsigned long GetNode(unsigned short val_node)=0
A pure virtual member.
virtual unsigned short GetnNeighbor_Nodes(unsigned short val_node)=0
A pure virtual member.
void SetCoord_CG(su2double **val_coord)
Set the center of gravity of an element (including edges).
virtual unsigned short GetnNodesFace(unsigned short val_face)=0
A pure virtual member.
void SetNeighbor_Elements(unsigned long val_elem, unsigned short val_face)
Set the elements that surround an element.
virtual void SetDomainElement(unsigned long val_domainelement)
A virtual member.
virtual unsigned short GetRotation_Type(void)
A pure virtual member.
virtual unsigned long GetDomainElement(void)
A virtual member.
virtual unsigned short GetFaces(unsigned short val_face, unsigned short val_index)=0
A pure virtual member.
virtual unsigned short GetVTK_Type(void)=0
A pure virtual member.
virtual void Change_Orientation(void)=0
A pure virtual member.
void SetGlobalIndex(unsigned long val_globalindex)
Set the global index for an element in a parallel computation.
virtual unsigned short GetNeighbor_Nodes(unsigned short val_node, unsigned short val_index)=0
virtual void SetNode(unsigned short val_node, unsigned long val_point)
A pure virtual member.
Class for prism element definition.
Class for pyramid element definition.
Class for quadrilateral element definition.
Class for tetrahedron element definition.
Class for triangle element definition.
Class for vertex definition for turbomachinery (equivalent to edges, but for the boundaries).
void SetTurboNormal(su2double *val_normal)
set Normal in the turbomachinery frame of reference.
void SetArea(su2double val_area)
set face Area.
void SetOldVertex(unsigned long val_vertex)
set vertex value not ordered.
void SetAngularCoord(su2double angCoord)
set angular coord.
su2double GetRelAngularCoord(void)
get angular coord.
su2double GetDeltaAngularCoord(void)
get angular coord.
void GetTurboNormal(su2double *val_normal)
Copy the the turbo normal vector of a face.
su2double GetArea(void)
get face Area associate to the vertex.
void SetDeltaAngularCoord(su2double deltaAngCoord)
set angular coord.
void SetRelAngularCoord(su2double minAngCoord)
set angular coord.
Class for vertex definition (equivalent to edges, but for the boundaries).
su2double * GetVarCoord(void)
Get the value of the coordinate variation due to a surface modification.
void GetNormal(su2double *val_normal)
Copy the the normal vector of a face.
void SetNormal_Neighbor(unsigned long val_Normal_Neighbor)
Set the index of the closest neighbor to a point on the boundaries.
void SetActDisk_Perimeter(bool val_actdisk_perimeter)
short GetRotation_Type(void)
Get the type of rotation associated to the vertex.
void SetNodes_Coord(su2double *val_coord_Edge_CG, su2double *val_coord_FaceElem_CG, su2double *val_coord_Elem_CG)
Set the face that correspond to a vertex.
void SetAuxTransp(su2double val_auxvar)
Set the value of an auxiliary tranpiration variable for gradient computation.
void AddAuxVar(su2double val_auxvar)
Add the value of an auxiliary variable for gradient computation.
void SetNormal(su2double *val_face_normal)
Set the normal vector.
void AddNormal(su2double *val_face_normal)
Add a vector to the normal vector.
unsigned long GetNode(void)
Get the node of the vertex.
void AddAuxTransp(su2double val_auxvar)
Add the value of an auxiliary tranpiration variable for gradient computation.
void SetAuxVar(su2double val_auxvar)
Set the value of an auxiliary variable for gradient computation.
void SetRotation_Type(short val_rotation_type)
Set the type of rotation associated to the vertex.
long GetDonorPoint(void)
Get the value of the periodic point of a vertex.
void SetDonorPoint(long val_periodicpoint, long val_processor)
Class for vertex element definition. This kind of element is used in the parallelization stuff.
codi::RealForward su2double
#define SUB(dest, v1, v2)
#define CROSS(dest, v1, v2)
const su2double eps
machine epsilon
CBaseMPIWrapper::Status * MPI_STATUS_IGNORE
#define MPI_UNSIGNED_LONG
#define MPI_UNSIGNED_SHORT
void RegisterInput(su2double &data)
Registers the variable as an input. I.e. as a leaf of the computational graph.
void RegisterOutput(su2double &data)
Registers the variable as an output. I.e. as the root of the computational graph.
double GetValue(const su2double &data)
Get the (primitive) value of the datatype (needs to be implemented for each new type).
int Int(const su2double &data)
Casts the primitive value to int (uses GetValue, already implemented for each type).
const int MASTER_NODE
Master node for MPI parallelization.
const su2double PI_NUMBER
Pi number.
@ NO
Boolean definition of no.
@ YES
Boolean definition of yes.
@ SU2_DEF
Running the SU2_DEF software.
@ SU2_CFD
Running the SU2_CFD software.
@ PARAVIEW
Paraview ASCII format for the solution output.
const unsigned short COMM_TYPE_CHAR
Communication type for char.
const su2double EPS
Error scale.
const unsigned short N_POINTS_LINE
General output & CGNS defines.
const unsigned short N_POINTS_QUADRILATERAL
General output & CGNS defines.
const unsigned short N_POINTS_PYRAMID
General output & CGNS defines.
const unsigned short COMM_TYPE_UNSIGNED_LONG
Communication type for unsigned long.
@ INCOMPRESSIBLE
Definition of incompressible solver.
@ COMPRESSIBLE
Definition of compressible solver.
@ TWOD_AIRFOIL
Airfoil analysis.
@ NACELLE
Nacelle analysis.
@ FUSELAGE
Fuselage analysis.
const unsigned int MESH_0
Definition of the finest grid level.
@ VERTEX
VTK nomenclature for defining a vertex element.
@ TRIANGLE
VTK nomenclature for defining a triangle element.
@ PYRAMID
VTK nomenclature for defining a pyramid element.
@ PRISM
VTK nomenclature for defining a prism element.
@ QUADRILATERAL
VTK nomenclature for defining a quadrilateral element.
@ HEXAHEDRON
VTK nomenclature for defining a hexahedron element.
@ LINE
VTK nomenclature for defining a line element.
@ TETRAHEDRON
VTK nomenclature for defining a tetrahedron element.
const unsigned short COMM_TYPE_LONG
Communication type for long.
@ CENTRIPETAL
centripetal turbomachinery.
@ AXIAL
axial turbomachinery.
@ CENTRIPETAL_AXIAL
mixed flow turbine.
@ CENTRIFUGAL
centrifugal turbomachinery.
@ AXIAL_CENTRIFUGAL
mixed flow turbine.
@ HARMONIC_BALANCE
Use a harmonic balance source term.
@ DT_STEPPING_1ST
Use a dual time stepping strategy for unsteady computations (1st order).
@ DT_STEPPING_2ND
Use a dual time stepping strategy for unsteady computations (2nd order).
@ FEM_NAVIER_STOKES
Definition of the finite element Navier-Stokes' solver.
@ FEM_RANS
Definition of the finite element Reynolds-averaged Navier-Stokes' (RANS) solver.
@ FEM_EULER
Definition of the finite element Euler's solver.
@ FEM_LES
Definition of the finite element Large Eddy Simulation Navier-Stokes' (LES) solver.
@ FEM_ELASTICITY
Definition of a FEM solver.
const unsigned short N_POINTS_HEXAHEDRON
General output & CGNS defines.
const int SINGLE_ZONE
There is only a zone.
const unsigned short N_POINTS_TETRAHEDRON
General output & CGNS defines.
const unsigned int OVERHEAD
Overhead space above nMarker when allocating space for boundary elems (MPI + periodic).
const int SINGLE_NODE
There is only a node in the MPI parallelization.
const int CGNS_STRING_SIZE
Length of strings used in the CGNS format.
const unsigned short N_POINTS_TRIANGLE
General output & CGNS defines.
const unsigned int MESH_1
Definition of the finest grid level.
@ INTERNAL_BOUNDARY
Internal Boundary definition.
@ EULER_WALL
Boundary Euler wall definition.
@ ISOTHERMAL
No slip isothermal wall boundary condition.
@ TRANSPIRATION
Transpiration definition.
@ SEND_RECEIVE
Boundary send-receive definition.
@ INLET_FLOW
Boundary inlet flow definition.
@ ACTDISK_OUTLET
Actuator disk outlet boundary definition.
@ HEAT_FLUX
No slip constant heat flux wall boundary condition.
@ DISPLACEMENT_BOUNDARY
Boundary displacement definition.
@ NEARFIELD_BOUNDARY
Near-Field boundary definition.
@ INTERFACE_BOUNDARY
Domain interface boundary definition.
@ CHT_WALL_INTERFACE
Domain interface definition.
@ LOAD_BOUNDARY
Boundary Load definition.
@ ACTDISK_INLET
Actuator disk inlet boundary definition.
@ PERIODIC_BOUNDARY
Periodic boundary definition.
@ AUTOMATIC
number of span-wise section are computed automatically
const unsigned int MAX_STRING_SIZE
Maximum number of domains.
@ INFLOW
flag for inflow marker for compute turboperformance.
@ OUTFLOW
flag for outflow marker for compute turboperformance.
const unsigned int MAX_NUMBER_PERIODIC
Maximum number of periodic boundary conditions.
const unsigned short COMM_TYPE_SHORT
Communication type for short.
const unsigned short COMM_TYPE_DOUBLE
Communication type for double.
@ SST
Kind of Turbulence model (Menter SST).
@ SA_NEG
Kind of Turbulent model (Spalart-Allmaras).
@ SA
Kind of Turbulent model (Spalart-Allmaras).
const unsigned short N_POINTS_PRISM
General output & CGNS defines.
@ BC
Kind of transition model (BAS-CAKMAKCIOGLU (BC) for Spalart-Allmaras).
const unsigned short COMM_TYPE_INT
Communication type for int.
@ CGNS
CGNS input format for the computational grid.
const unsigned short COMM_TYPE_UNSIGNED_SHORT
Communication type for unsigned short.
@ US
Definition of incompressible solver.
@ SI
Definition of compressible solver.
@ ALLOCATE
Allocate geometry structure.
@ UPDATE
Update geometry structure (grid moving, adaptation, etc.).